This example demonstrates playback of a stream with audio only.
Please refer to the Basic Subscriber Documentation to learn more about the basic setup.
These examples use the WebRTC-based Subscriber implementation from the Red5 Pro HTML SDK. However, there is failover support to allow for Flash-based subscriber on unsupported browsers.
The audio
element is used for the assignment of the media stream blob:
<audio id="red5pro-subscriber" controls autoplay class="red5pro-media"></audio>
Initialization and playback of a Red5 Pro stream in an audio
element is similar to one in a video
element:
var subscriber = new red5pro.RTCSubscriber();
subscriber.init(config)
.then(function () {
return subscriber.subscribe();
})
.then(function () {
console.log('Successfully started a subscription session!');
})
.catch(function (error) {
console.error('Could not start a subscription session: ' + error);
});
[index.js #112](index.js#L112]