Stream Class Events - iOS
state
- This callback is triggered when the state of a video or screen-share video stream changes.
- It helps track whether the stream is active, stuck, frozen, resolved, or ended.
- Add the listener with
on()and remove it withoff(). The listener is called on the main thread.
note
This event is emitted exclusively for remote participants, specifically for their video and screen share video streams.
Parameters
-
state: Specifies the current state of the stream.- Type:
StreamState - Possible values:
StreamState.ACTIVE: Stream is working normally.StreamState.STUCK: Stream is not progressing as expected.StreamState.FREEZE_DETECTED: Video freeze has been detected.StreamState.FREEZE_RESOLVED: Video freeze has been resolved.StreamState.ENDED: Stream has ended.
- Type:
Example
let listenerId = stream.on(.state) { state in
if state == .FREEZE_DETECTED || state == .STUCK {
// show a "poor connection" badge on the participant's tile
} else if state == .ACTIVE || state == .FREEZE_RESOLVED {
// hide the badge
}
}
// When you no longer need the listener
stream.off(.state, listenerId: listenerId)
Got a Question? Ask us on discord

