Skip to main content
Version: 4.x.x

HLS Events - iOS

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

onHlsStateChanged​

  • This event will be triggered when the room's HLS status changes.
  • All available states are HLS_STARTING, HLS_STARTED, HLS_PLAYABLE, HLS_STOPPING and HLS_STOPPED.
  • When the state is HLS_PLAYABLE, hlsUrl holds the playbackHlsUrl and livestreamUrl of the stream.
  • Implement this method of the RoomEventListener protocol, and register the listener with the addEventListener(_:) method of the Room class.

Example​

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

extension RoomViewController: RoomEventListener {
func onHlsStateChanged(state: HLSState, hlsUrl: HLSUrl?) {
switch(state) {
case .HLS_STARTING:
print("HLS Starting")

case .HLS_STARTED:
self.hlsStreamStarted = true
print("HLS Started")

case .HLS_PLAYABLE:
print("HLS Playable: \(hlsUrl?.playbackHlsUrl ?? "")")

case .HLS_STOPPING:
print("HLS Stopping")

case .HLS_STOPPED:
self.hlsStreamStarted = false
print("HLS Stopped")

@unknown default:
break
}
}
}

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