RoomSessionStream
Represents a specific stream of a room session. This is an RTMP stream of the audio/video content of the room, which will be sent to an external party (e.g., to YouTube).
You can start a stream with RoomSession.startStream.
Properties
id
The unique id of this stream.
roomId
The id of the room associated to this stream.
roomSessionId
The id of the room session associated to this stream.
state
Current state of the stream.
url
The RTMP URL of the stream.
duration
Total seconds of time spent streaming, if available. This is equal to (endedAt - startedAt).
startedAt
Start time, if available.
endedAt
End time, if available.
hasEnded
Whether the stream has ended. Returns true if the state is "completed".
Methods
stop
- stop():
Promise<void>
Stops the stream.
Returns
Promise<void>
Example
In this example, we wait for a room to start and then start
a stream in that room. We then stop the stream after 10 seconds.
This example assumes that there is a RoomSession already active and that members are joining the room.
Events
onStarted
- RoomSessionStream(
{ listen: {onStarted: Callback }})
Emitted when the stream has started.
Parameters
stream
The stream that has started. See RoomSessionStream.
onEnded
- RoomSessionStream(
{ listen: {onEnded: Callback } })
Emitted when the stream has ended.
Parameters
stream
The stream that has ended. See RoomSessionStream.