RoomSessionPlayback
Instances of this class allow you to control (e.g., pause, resume, stop) the playback inside a room session. You can obtain instances of this class by starting a playback from the desired RoomSession (see RoomSession.play)
Properties
id
Unique id for this playback.
roomId
Id of the room associated to this playback.
roomSessionId
Id of the room session associated to this playback.
url
Url of the file reproduced by this playback.
state
Current state of the playback.
position
Current playback position, in milliseconds.
volume
Audio volume at which the playback file is reproduced.
startedAt
Start time, if available.
endedAt
End time, if available.
hasEnded
Whether the playback has ended. Returns true if the state is "completed".
Methods
forward
▸ forward(offset): Promise<void>
Seeks the current playback forward by the specified offset.
Parameters
offset
Relative number of milliseconds to seek forward from the current position.
Returns
Promise<void>
Example
In this example, we wait for the RoomSession to start,
then we start a playback and forward it by 10 seconds after 5 seconds.
This example assumes that a RoomSession is active and
members are joining the room.
pause
▸ pause(): Promise<void>
Pauses the playback.
Returns
Promise<void>
Example
In this example, we wait for the RoomSession to start,
then we start a playback.
After 5 seconds, we pause the playback.
This example assumes that a RoomSession is active and
members are joining the room.
resume
▸ resume(): Promise<void>
Resumes the playback.
Returns
Promise<void>
Example
In this example, we wait for the RoomSession to start,
then we start a playback and pause it.
After 5 seconds, we resume the playback.
This example assumes that a RoomSession is active and
members are joining the room.
rewind
▸ rewind(offset): Promise<void>
Seeks the current playback backwards by the specified offset.
Parameters
offset
Relative number of milliseconds to seek backwards from the current position.
Returns
Promise<void>
Example
In this example, we wait for the RoomSession to start,
then we start a playback. After 10 seconds, we rewind the playback by 5 seconds.
This example assumes that a RoomSession is active and
members are joining the room.
seek
▸ seek(timecode): Promise<void>
Seeks the current playback to the specified absolute position.
Parameters
timecode
The absolute position in milliseconds to seek to in the playback.
Returns
Promise<void>
Example
In this example, we wait for the RoomSession to start,
then we start a playback. We then seek the playback to the 30th second.
This example assumes that a RoomSession is active and
members are joining the room.
setVolume
▸ setVolume(volume): Promise<void>
Sets the audio volume for the playback.
Parameters
volume
The desired volume. Values range from -50 to 50.
Returns
Promise<void>
Example
In this example, we wait for the RoomSession to start,
then we start a playback. After 5 seconds, we set the volume to -50dB.
This example assumes that a RoomSession is active and
members are joining the room.
stop
▸ stop(): Promise<void>
Stops the playback.
Returns
Promise<void>
Example
In this example, we wait for the RoomSession to start,
then we start a playback. After 5 seconds, we stop the playback.
This example assumes that a RoomSession is active and
members are joining the room.
Events
onStarted
▸ RoomSessionPlayback(listen: {onStarted: Callback })
Emitted when the playback starts.
Parameters
playback
The playback that started. See RoomSessionPlayback.
onUpdated
▸ RoomSessionPlayback(listen: {onUpdated: Callback })
Emitted when the playback is updated.
Parameters
playback
The playback that updated. See RoomSessionPlayback.
onEnded
▸ RoomSessionPlayback(listen: {onEnded: Callback })
Emitted when the playback ends.
Parameters
playback
The playback that ended. See RoomSessionPlayback.