onStreamStateChanged

fun onStreamStateChanged(state: StreamState, peerId: String, streamId: String)

Called when a remote participant's video stream health changes.

The SDK polls WebRTC receive-transport stats and fires FREEZE_DETECTED when the decoder reports a freeze, FREEZE_RESOLVED once frames flow again, and STUCK when the receive bitrate stays at zero for several seconds. Fired on the main thread.

Code Example:


public void onStreamStateChanged(StreamState state, String peerId, String streamId) {
    if (state == StreamState.FREEZE_DETECTED) {
        Log.w("Participant", "Stream frozen: " + streamId);
    }
}

Parameters

state

the new stream health state

peerId

ID of the participant whose stream changed

streamId

WebRTC track ID of the affected stream