> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # 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](/docs/browser-sdk/v3/js/reference/video/room-session) (see [RoomSession.play](/docs/browser-sdk/v3/js/reference/video/room-session/play)). ## Properties **`endedAt`** `Date` End time, if available. --- **`id`** `string` — required Unique id for this playback. --- **`position`** `number` — required Current playback position, in milliseconds. --- **`roomSessionId`** `string` — required Id of the room session associated to this playback. --- **`seekable`** `boolean` — required Whether the seek functions ([seek](#seek), [forward](#forward), [rewind](#rewind)) can be used for this playback --- **`startedAt`** `Date` — required Start time, if available. --- **`state`** `"paused" | "completed" | "playing"` — required Current state of the playback. --- **`url`** `string` — required Url of the file reproduced by this playback. --- **`volume`** `number` — required Audio volume at which the playback file is reproduced. --- ## Methods ### forward ▸ **forward**(`offset`): `Promise` Seeks the current playback forward by the specified offset. #### Parameters **`offset`** `number` Relative number of milliseconds to seek forward from the current position. Defaults to 5000 (5 seconds). --- #### Returns `Promise` #### Permissions * `room.playback.seek` or the more permissive `room.playback` You need to specify the permissions when [creating the Video Room Token](/docs/apis/rest/video/room-tokens/create-room-token) on the server side. #### Example ```javascript const playback = await roomSession.play({ url: "rtmp://example.com/foo" }); await playback.forward(5000); // 5 seconds ``` --- ### pause ▸ **pause**(): `Promise` Pauses the playback. #### Returns `Promise` --- ### resume ▸ **resume**(): `Promise` Resumes the playback. #### Returns `Promise` --- ### rewind ▸ **rewind**(`offset`): `Promise` Seeks the current playback backwards by the specified offset. #### Parameters **`offset`** `number` Relative number of milliseconds to seek backwards from the current position. Defaults to 5000 (5 seconds). --- #### Returns `Promise` #### Permissions * `room.playback.seek` or the more permissive `room.playback` You need to specify the permissions when [creating the Video Room Token](/docs/apis/rest/video/room-tokens/create-room-token) on the server side. #### Example ```javascript const playback = await roomSession.play({ url: "rtmp://example.com/foo" }); await playback.rewind(5000); // 5 seconds ``` --- ### seek ▸ **seek**(`timecode`): `Promise` Seeks the current playback to the specified absolute position. #### Parameters **`timecode`** `number` — required The absolute position in milliseconds to seek to in the playback. --- #### Returns `Promise` #### Permissions * `room.playback.seek` or the more permissive `room.playback` You need to specify the permissions when [creating the Video Room Token](/docs/apis/rest/video/room-tokens/create-room-token) on the server side. #### Example ```javascript const playback = await roomSession.play({ url: "rtmp://example.com/foo" }); await playback.seek(30_000); // 30th second ``` --- ### setVolume ▸ **setVolume**(`volume`): `Promise` Sets the audio volume for the playback. #### Parameters **`volume`** `number` — required The desired volume. Values range from -50 to 50, with a default of 0. --- #### Returns `Promise` --- ### stop ▸ **stop**(): `Promise` Stops the playback. #### Returns `Promise`