*** id: ba8c2c45-3fb4-4c3c-8ca5-783da1d1109c title: RoomSessionPlayback slug: /node/reference/video/room-session-playback sidebar-title: RoomSessionPlayback description: >- RoomSessionPlayback reference for controlling media playback in video rooms. Pause, resume, seek, and stop playback of videos and audio in room sessions. max-toc-depth: 3 ---------------- [link-1]: #forward [link-2]: #rewind [link]: #seek [video-roomsession-1]: /docs/server-sdk/v3/node/reference/video/room-session/play [video-roomsession]: /docs/server-sdk/v3/node/reference/video/room-session 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][video-roomsession] (see [RoomSession.play][video-roomsession-1]) ## Properties ### endedAt • `Optional` **endedAt**: `Date` End time, if available. *** ### id • **id**: `string` Unique id for this playback. *** ### position • **position**: `number` Current playback position, in milliseconds. *** ### roomSessionId • **roomSessionId**: `string` Id of the room session associated to this playback. *** ### seekable • **seekable**: `boolean` Whether the seek functions ([seek][link], [forward][link-1], [rewind][link-2]) can be used for this playback *** ### startedAt • **startedAt**: `Date` Start time, if available. *** ### state • **state**: `"paused"` | `"completed"` | `"playing"` Current state of the playback. *** ### url • **url**: `string` Url of the file reproduced by this playback. *** ### volume • **volume**: `number` Audio volume at which the playback file is reproduced. ## Methods ### forward ▸ **forward**(`offset`): `Promise` Seeks the current playback forward by the specified offset. #### Parameters | Name | Type | Description | | :-------- | :------- | :------------------------------------------------------------------------------------------------------- | | `offset?` | `number` | Relative number of milliseconds to seek forward from the current position. Defaults to 5000 (5 seconds). | #### Returns `Promise` #### 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 | Name | Type | Description | | :-------- | :------- | :-------------------------------------------------------------------------------------------------- | | `offset?` | `number` | Relative number of milliseconds to seek backwards from the current position. Defaults to 5 seconds. | #### Returns `Promise` #### 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 | Name | Type | Description | | :--------- | :------- | :---------------------------------------------------------------- | | `timecode` | `number` | The absolute position in milliseconds to seek to in the playback. | #### Returns `Promise` #### 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 | Name | Type | Description | | :------- | :------- | :-------------------------------------------------------------------- | | `volume` | `number` | The desired volume. Values range from -50 to 50, with a default of 0. | #### Returns `Promise` *** ### stop ▸ **stop**(): `Promise` Stops the playback. #### Returns `Promise`