Skip to main content
Version: 0.0.x

Stop HLS - Javascript

Stopping HLS refers to the process of halting the ongoing HLS stream transmission, indicating that the stream is no longer accessible to viewers.

Stopping HLS​

The stopHls() method, accesible from the meeting object, is used to stop the interactive livestream of a meeting.

Example​

let meeting;

// Initialize Meeting
meeting = VideoSDK.initMeeting({
// ...
});

const stopHlsBtn = document.getElementById("stopHlsBtn");
stopHlsBtn.addEventListener("click", () => {
// Stop HLS
meeting?.stopHls();
});

Event associated with HLS​

  • hls-state-changed - The hls-state-changed event is triggered whenever the state of meeting HLS changes.

  • You will get HLS_STOPPING and HLS_STOPPED status on calling stopHls().

note

downstreamUrl is now depecated. Use playbackHlsUrl or livestreamUrl in place of downstreamUrl

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) {
// on hlsStateChanged 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 utilized in this guide are provided below.

Got a Question? Ask us on discord