voiceTransport

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:, status: "" } Status codes: "success.seek-start" — target < 0; clamped to 0 "success.seek-end" — target >= duration; clamped to (duration - endSlackSeconds) "success" — within bounds; clamped == target 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).

Parameters:
NameTypeDescription
targetfloat
durationdynamic
endSlackSecondsinteger
Returns:
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.

Parameters:
NameTypeDescription
itemobject
Returns:
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:} when the payload is parsable { valid: false, delta: 0 } when duration is missing

Parameters:
NameTypeDescription
evtobject
Returns:
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.

Parameters:
NameTypeDescription
configureddynamic
Returns:
Type: 
integer