Pure helpers for the Roku voice transport dispatch path. The player components (VideoPlayerView, AudioPlayerView) own the state mutations (m.top.control, m.top.seek, m.audioPlayer.*) but delegate the math + setting resolution + payload parsing here so it's unit-testable without instantiating a full player.
See https://github.com/rokudev/dev-doc — docs/DEVELOPER/media-playback/voice-controls/transport-controls.md
Methods
(static) computeSeekStatus(target, duration, endSlackSeconds) → {object}
Compute the bounds-checked seek result. Returns: { clamped:endSlackSeconds is how far before the duration to clamp end-of-content seeks so the player doesn't immediately fire end-of-playback (Roku reference uses 30 for video; audio uses 5 since songs are short).
| Name | Type | Description |
|---|---|---|
target | float | |
duration | dynamic | |
endSlackSeconds | integer |
- Type:
- object
(static) formatNowPlayingTitle(item) → {string}
Build the title string for SetNowPlayingContentMetaData(). For Episodes and Recordings with a populated seriesName, prepends the show name as "SeriesName - EpisodeTitle" so Roku's HUD reads back the show, not just the episode title in isolation. Falls back to name for everything else (Movies, Episodes missing seriesName, …). Returns "" when no usable title exists.
| Name | Type | Description |
|---|---|---|
item | object |
- Type:
- string
(static) parseSeekDelta(evt) → {object}
Parse the seek voice command's payload into a signed delta in seconds. Roku delivers direction ("forward" or "backward") and duration (string seconds) alongside command = "seek". Returns: { valid: true, delta:duration is missing
| Name | Type | Description |
|---|---|---|
evt | object |
- Type:
- object
(static) resolveInstantReplaySeconds(configured) → {integer}
Resolve the user's instant-replay setting (in seconds), falling back to 10s (the platform-standard "rewind 10-25 seconds" midpoint) when the setting is missing, invalid, or non-positive.
| Name | Type | Description |
|---|---|---|
configured | dynamic |
- Type:
- integer