Stream Class Events - Javascript
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.
Parameters
-
state
: Specifies the current state of the stream.- Type:
String
- Possible values:
"active"
: Stream is working normally."stuck"
: Stream is not progressing as expected."freeze-detected"
: Video freeze has been detected."freeze-resolved"
: Video freeze has been resolved."ended"
: Stream has ended.
- Type:
-
timestamp
: The time (in milliseconds since epoch) when the state change occurred.- Type:
Number
- Type:
Example
stream.on("state", ({ state, timestamp }) => {
//
});
Got a Question? Ask us on discord