play

View as Markdown

play

Starts 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

Object containing the parameters of the method.

url
string

The url (http, https, rtmp, rtmps) of the stream to reproduce.

volume
number

The audio volume at which to play the stream. Values range from -50 to 50, with a default of 0.

seekPosition
number

The starting timecode in milliseconds for playback. Defaults to 0.

positions
VideoPositions

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
string

Layout to change to when the playback starts.

Returns

Promise<RoomSessionPlayback> - See RoomSessionPlayback documentation for more details.

Permissions

  • room.playback

You need to specify the permissions when creating the Video Room Token on the server side.

Example

1const playback = await roomSession.play({ url: "rtmp://example.com/foo" });
2await playback.stop();