Stop HLS - Android
This could refer to stopping the transmission of an ongoing HLS stream, which would mean the stream is no longer available to viewers.
Stopping HLS
stopHls()is used to stop interactive livestream of the meeting which can be accessed from theMeetingclass.
Example
- Kotlin
- Java
findViewById<View>(R.id.btnStopHls).setOnClickListener { view: View? ->
// Stop Hls
meeting!!.stopHls()
}
findViewById(R.id.btnStopHls).setOnClickListener(view -> {
// Stop Hls
meeting.stopHls();
});
Event associated with HLS
-
onHlsStateChanged - Whenever meeting HLS state changes, then
onHlsStateChangedevent will trigger. -
You will get
HLS_STOPPINGandHLS_STOPPEDstatus on callingstopHls().
note
downstreamUrl is now depecated. Use playbackHlsUrl or livestreamUrl in place of downstreamUrl
- Kotlin
- Java
private val meetingEventListener: MeetingEventListener = object : MeetingEventListener() {
override fun onHlsStateChanged(HlsState: JSONObject) {
when (HlsState.getString("status")) {
"HLS_STARTING" -> Log.d("onHlsStateChanged", "Meeting hls is starting")
"HLS_STARTED" -> Log.d("onHlsStateChanged", "Meeting hls is started")
"HLS_PLAYABLE" -> {
Log.d("onHlsStateChanged", "Meeting hls is playable now")
// on hls playable you will receive playbackHlsUrl and livestreamUrl
val playbackHlsUrl = HlsState.getString("playbackHlsUrl")
val livestreamUrl = HlsState.getString("livestreamUrl")
}
"HLS_STOPPING" -> Log.d("onHlsStateChanged", "Meeting hls is stopping")
"HLS_STOPPED" -> Log.d("onHlsStateChanged", "Meeting hls is stopped")
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
//...
// add listener to meeting
meeting!!.addEventListener(meetingEventListener)
}
private final MeetingEventListener meetingEventListener = new MeetingEventListener() {
@Override
public void onHlsStateChanged(JSONObject HlsState) {
switch (HlsState.getString("status")) {
case "HLS_STARTING":
Log.d("onHlsStateChanged", "Meeting hls is starting");
break;
case "HLS_STARTED":
Log.d("onHlsStateChanged", "Meeting hls is started");
break;
case "HLS_PLAYABLE":
Log.d("onHlsStateChanged", "Meeting hls is playable now");
// on hls started you will receive playbackHlsUrl and livestreamUrl
String playbackHlsUrl = HlsState.getString("playbackHlsUrl");
String livestreamUrl = HlsState.getString("livestreamUrl");
break;
case "HLS_STOPPING":
Log.d("onHlsStateChanged", "Meeting hls is stopping");
break;
case "HLS_STOPPED":
Log.d("onHlsStateChanged", "Meeting hls is stopped");
break;
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
//...
// add listener to meeting
meeting.addEventListener(meetingEventListener);
}
API Reference
The API references for all the methods utilized in this guide are provided below.
Got a Question? Ask us on discord

