我需要在本地广播我的蒸汽,以供开发之用。但是错误来了。我是媒体服务器的新手。我只想把red5pro媒体服务器集成到我的网站上进行多个广播。目前,我从youtube上跟踪Red5pro发布者文档和本教程,将red5probeginner测试到媒体服务器上。这个教程有点过时,但是我仍然在关注它,因为我没有找到任何其他的red5pro教程。
我使用("python -m http.server 8000")来运行本地服务器,这在视频教程中已经讲过了。
我的html代码->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="video-container">
<video id="red5pro-publisher"></video>
</div>
<script src="lib/red5pro/red5pro-sdk.min.js"></script>
<script>
// Create a new instance of the WebRTC publisher.
var publisher = new red5prosdk.RTCPublisher();
// Create a view instance based on video element id.
var view = new red5prosdk.PublisherView('red5pro-publisher');
view.attachPublisher(publisher);
// Access user media.
navigator.getUserMedia({
audio: true,
video: true
}, function (media) {
// Upon access of user media,
// 1. Attach the stream to the publisher.
// 2. Show the stream as preview in view instance.
publisher.attachStream(media);
view.preview(media, true);
}, function (error) {
console.error(error);
});
// Using Chrome/Google TURN/STUN servers.
var iceServers = [{ urls: 'stun:stun2.l.google.com:19302' }];
// Initialize
publisher.init({
protocol: 'ws',
host: 'localhost',
port: 8081,
app: 'live',
streamName: 'mystream',
iceServers: iceServers,
tcpMuxPolicy: 'negotiate'
})
.then(function () {
// Invoke the publish action
return publisher.publish();
})
.catch(function (error) {
// A fault occurred while trying to initialize and publish the stream.
console.error(error);
});
</script>
</body>
<!-- WebRTC Shim -->
<!-- <script src="https://webrtc.github.io/adapter/adapter-latest.js"></script> -->
<!-- Exposes `red5prosdk` on the window global. -->
</html>误差->

我认为它不能创建websocket!
发布于 2021-11-05 13:22:31
我不是HTML5 SDK的专家,但我看到您已经将媒体设置和其他几行注释掉了;取消注释,然后再试一次。还可以查看服务器上的red5.log,寻找其他线索;任何异常触发都会有帮助。
https://stackoverflow.com/questions/69837977
复制相似问题