I need to broadcast my steam in localhost for developing purposes. But the error comes in. I am new to media servers. I just wanna integrate the red5pro media server for one to many broadcasting in my website. I am currently following Red5pro Publisher Docs and this tutorial from youtube for testing red5pro[beginner to media servers]. The tutorial is little outdated but i am still following it because i didn't find any other tutorial for red5pro.
I am using python simplehttpserver ("python -m http.server 8000") to run local server as told in the video tutorial.
My html code ->
<!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>
The error ->
I think it is not able to create websocket!!