HLS Events - Javascript
VideoSDK provides the hls-state-changed
event, which informs you about the current state of HLS for the meeting.
hls-state-changed​
- This event is triggered when the HLS status of the meeting changes.
- It can be subscribed to using the
meeting
object.
note
downstreamUrl
is now depecated. Use playbackHlsUrl
or livestreamUrl
in place of downstreamUrl
Example​
Here is an example demonstrating the usage of the event mentioned on this page.
let meeting;
// Initialize Meeting
meeting = VideoSDK.initMeeting({
// ...
});
const Constants = VideoSDK.Constants;
meeting.on("hls-state-changed", (data) => {
const { status } = data;
if (status === Constants.hlsEvents.HLS_STARTING) {
console.log("Meeting Hls is starting");
} else if (status === Constants.hlsEvents.HLS_STARTED) {
// when hls is started you will receive playbackHlsUrl and livestreamUrl.
const { playbackHlsUrl } = data;
console.log("Meeting Hls is started");
} else if (status === Constants.hlsEvents.HLS_STOPPING) {
console.log("Meeting Hls is stopping");
} else if (status === Constants.hlsEvents.HLS_STOPPED) {
console.log("Meeting Hls is stopped");
} else {
//
}
});
API Reference​
The API references for all the methods and events utilized in this guide are provided below.
Got a Question? Ask us on discord