Publishing to Transcoder (WebRTC)
Since WebRTC clients require secure websockets to broadcast, in a Red5 Pro Autoscale environment the stream manager proxies the websocket connection between the publisher and the transcoder (or origin) node.
In the case where the response to the GET
request at:
https://yourstreammanager.com/streammanager/api/4.0/event/live/mystream?action=broadcast&transcode=true
is the following:
{
"serverAddress": "10.0.0.0",
"scope": "live",
"name": "mystream_1"
}
Your initialization configuration for an RTCPublisher
will look like the following:
(function (red5prosdk) {
var publisher = new red5prosdk.RTCPublisher()
publisher.init({
host: 'yourstreammanager.com',
app: 'streammanager',
streamName: 'mystream_1',
protocol: 'wss',
port: 443,
mediaConstraints: {
audio: true,
video: {
width: 1280,
height: 780
}
},
bandwidth: {
video: 1000
},
connectionParams: {
host: '10.0.0.0',
app: 'live'
}
})
.then(function () {
publisher.publish()
})
.catch(function (e) {
console.error(e)
})
})(window.red5prosdk)
The above is a very basic configuration. Your webapp may need additional configurations depending on requirements and deployment.
When utilizing the Stream Manager proxy for WebRTC broadcasts, you assign the top-level configuration app
property as streammanager
, and provide a connectionParams
object that details the endpoint to proxy to.
Additionally, note the mediaContraints
object on the initialization configuration and that it defines the video contraint with the corresponding variant qualities for mystream_1
from the above examples. This will be used in accessing the getUserMedia
of the browser client.