Skip to main content
Version: 2.0.x

Stop HLS - iOS

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 the Meeting class.

Example

  func stopHLS() {
DispatchQueue.main.async {
self.meeting?.stopHLS()
}
}

Event associated with HLS

  • onHlsStateChanged - Whenever meeting HLS state changes, then onHlsStateChanged event will trigger.

  • 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

class MeetingViewController: ObservableObject {
//...
// Add event listeners and join the meeting
meeting?.addEventListener(self)
//...
}

extension MeetingViewController: MeetingEventListener {
//...
func onHlsStateChanged(state: HLSState, hlsUrl: HLSUrl?) {
hlsState = state
switch (state) {
case .HLS_STARTING:
print("HLS is Starting")
case .HLS_STARTED:
print("HLS is Started")
case .HLS_PLAYABLE:
print("HLS is Playable Now!")
// on hls started you will receive playbackHlsUrl and livestreamUrl
let playableURL = hlsUrl?.playbackHlsUrl ?? ""
let liveStreamURL = hlsUrl?.livestreamUrl ?? ""
case .HLS_STOPPING:
print("HLS is Stopping")
case .HLS_STOPPED:
print("HLS is Stopped")
@unknown default:
fatalError("Unknown HLS State")
}
}
}
//...

API Reference

The API references for all the methods utilized in this guide are provided below.

Got a Question? Ask us on discord