Skip to main content
Version: 0.1.x

HLS Events - Android

VideoSDK provides onHlsStateChanged event which will notify you of the current state of HLS for the meeting.

onHlsStateChanged

  • This event will be triggered when the meeting's HLS status changed.
  • You can implement this method of the abstract Class MeetingEventListener and add the listener to Meeting class using the addEventListener() method of Meeting Class.
  • when you receive HLS_PLAYABLE status you will receive 2 urls in response
    • playbackHlsUrl - Live HLS with playback support
    • livestreamUrl - Live HLS without playback support
note

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

Example

Here is the usage of the event mentioned in this page.

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)
}

API Reference

The API references for all the methods and events utilised in this guide are provided below.

Got a Question? Ask us on discord