play
play
- play(
params):Promise<RoomSessionPlayback>
Start a playback in the room. You can use the returned RoomSessionPlayback object to control the playback (e.g., pause, resume, setVolume and stop).
Parameters
params
Object containing the parameters of the method.
url
The url (http, https, rtmp, rtmps) of the stream to reproduce.
seekPosition
The starting timecode in milliseconds for playback.
volume
The playback volume from -50 to 50.
positions
Positions to assign as soon as the playback starts. You can use the special keyword self to refer to the id of the playback.
layout
Layout to change to when the playback starts.
listen
Object of event listeners. See RoomSessionPlayback Events for a list of valid events. Example event: onStarted.
Returns
Promise<RoomSessionPlayback>
A promise that resolves to a RoomSessionPlayback object.
Example
In this example, we wait for a room to start and then play a video in that room.
When a second member joins the roomSession, we stop the playback.
This example assumes that there is a RoomSession
already active and that members are joining the room.