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_STOPPINGandHLS_STOPPED. - When the state is
HLS_PLAYABLE,hlsUrlholds theplaybackHlsUrlandlivestreamUrlof the stream. - Implement this method of the
RoomEventListenerprotocol, and register the listener with theaddEventListener(_:)method of theRoomclass.
Example
Here is the usage of the event mentioned in this page.
- Swift
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

