Methods

(static) availableSubtitleTrackIndex(availableSubtitleTracks, trackNameToFind) → {integer}

Roku translates the tracks we supply into availableSubtitleTracks, dropping any it does not understand — so its indexing does not match Jellyfin's. This maps a Jellyfin track name onto Roku's list.

Substring rather than equality: Roku mangles the name it was given (our value survives inside it), so an exact compare never matches.

Parameters:
NameTypeDescription
availableSubtitleTracksobject
trackNameToFindstring
Returns:
  • index into availableSubtitleTracks, or SubtitleSelection.NONE
Type: 
integer

(static) buildAudioTrackOptions(audioStreams, currentAudioIndex) → {object}

Audio tracks. values are Jellyfin stream indexes, which is what VideoPlayerView.audioIndex takes.

Parameters:
NameTypeDescription
audioStreamsobject

VideoPlayerView.fullAudioData (array of audio MediaStreams)

currentAudioIndexinteger

the stream index playing now (VideoPlayerView.audioIndex)

Returns:
  • { labels, values, defaultIndex }
Type: 
object

(static) buildSubtitleTrackOptions(subtitleStreams, selectedSubtitleIndex, currentTrackName, availableSubtitleTracks) → {object}

Subtitle tracks, with a "None" option always first.

Each value is { index, isEncoded, trackName }: index - Jellyfin stream index, or SubtitleSelection.NONE for the None row isEncoded - burned into the video by the transcoder, so Roku cannot toggle it trackName - the Jellyfin track name, matched against Roku's own mangled availableSubtitleTracks names (see availableSubtitleTrackIndex)

Which row is active depends on where the current subtitle came from: an in-file track is identified by its Jellyfin index, while an external one is only identifiable by matching the Roku track name currently set on the player.

Parameters:
NameTypeDescription
subtitleStreamsobject

VideoPlayerView.fullSubtitleData

selectedSubtitleIndexinteger

VideoPlayerView.selectedSubtitle

currentTrackNamestring

VideoPlayerView.subtitleTrack (Roku's name for the active track)

availableSubtitleTracksobject

VideoPlayerView.availableSubtitleTracks

Returns:
  • { labels, values, defaultIndex }
Type: 
object

(static) buildVideoSourceOptions(videoSources, currentMediaSourceId) → {object}

Video sources (alternate versions of the same item). values are MediaSource ids, which is what VideoPlayerView.mediaSourceId takes.

Parameters:
NameTypeDescription
videoSourcesobject

VideoPlayerView.fullVideoSourceData (array of MediaSources)

currentMediaSourceIdstring

the source playing now

Returns:
  • { labels, values, defaultIndex }
Type: 
object

(static) isSubtitleStreamActive(stream, selectedSubtitleIndex, currentTrackName, availableSubtitleTracks) → {boolean}

Is this the subtitle stream currently showing? Split out because the two cases answer completely different questions (see buildSubtitleTrackOptions).

Parameters:
NameTypeDescription
streamobject
selectedSubtitleIndexinteger
currentTrackNamestring
availableSubtitleTracksobject
Returns:
Type: 
boolean