Members
(static, readonly) JellyfinLanguage
JellyfinLanguage: ISO 639-2 three-letter language codes used by Jellyfin Only includes languages supported by Roku OS locales
| Name | Type | Description |
|---|---|---|
ENGLISH | ||
SPANISH | ||
PORTUGUESE | ||
FRENCH | ||
GERMAN | ||
ITALIAN |
Methods
(static) findBestAudioStreamIndex(streams, playDefault, preferredLanguage, deviceCapabilitiesopt) → {integer}
findBestAudioStreamIndex: Primary function for selecting the best audio stream
Selection priority when playDefault = true (Jellyfin: "Play default audio track regardless of language"):
- Filter by IsDefault = true streams (ignore language preference)
- If multiple IsDefault streams, use language preference as tiebreaker
- If still multiple or no language match, apply hardware optimization
- If no IsDefault streams exist, fall back to language preference → hardware optimization
Selection priority when playDefault = false:
- Filter by language preference (completely ignore IsDefault flag)
- If multiple language matches, apply hardware optimization
- If no language matches, apply hardware optimization to all streams
Roku OS Language Fallback: When preferredLanguage is blank/empty, automatically uses the Roku device's OS language (from m.global.device.locale) as fallback for better out-of-box experience (see issue #179)
Hardware optimization:
- Prefer streams matching device's max channel capability
- Among matches, prefer direct-playable codecs
- Fall back intelligently based on channel counts
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
streams | dynamic | Array of media streams from Jellyfin metadata | ||
playDefault | dynamic | Boolean, if true use IsDefault flag and only use language as tiebreaker | ||
preferredLanguage | dynamic | Three-letter language code (e.g., "eng", "jpn") | ||
deviceCapabilities | dynamic | <optional> | invalid | Optional: Device audio capabilities (for testing). If invalid, will detect automatically. |
- Jellyfin index of best audio stream, or 0 if not found
- Type:
- integer
(static) findDirectPlayableStreamByChannelCount(audioStreams, targetChannels, deviceCapabilities) → {dynamic}
findDirectPlayableStreamByChannelCount: Finds a direct-playable stream with specific channel count
| Name | Type | Description |
|---|---|---|
audioStreams | object | Array of audio streams |
targetChannels | integer | Desired channel count (2, 6, or 8) |
deviceCapabilities | object | Device capability info |
- Matching stream or invalid
- Type:
- dynamic
(static) getDeviceAudioCapabilities() → {object}
getDeviceAudioCapabilities: Detects device audio codec and channel support
Strategy:
- Use combined check (no PassThru) for 6-channel and below (safe, checks both)
- ALWAYS verify 8-channel with PassThru: 1 (combined check can lie)
- Roku max native decode is 6 channels (varies by model)
- 8-channel requires HDMI passthrough to receiver/soundbar
maxChannels (integer: 2, 6, or 8) - Maximum supported audio channels supports8Channel (boolean) - True if HDMI passthrough supports 8-channel audio
- AssocArray with:
- Type:
- object
(static) isStreamDirectPlayable(stream, deviceCapabilities) → {boolean}
isStreamDirectPlayable: Checks if an audio stream can be directly played by the device
For 8-channel: MUST use PassThru: 1 (only HDMI passthrough, Roku can't decode 8-channel) For 6-channel and below: Use combined check (no PassThru) - checks both Roku and HDMI
| Name | Type | Description |
|---|---|---|
stream | object | Audio stream object with codec and channels fields |
deviceCapabilities | object | Device capability info |
- True if stream can be direct played
- Type:
- boolean
(static) mapRokuLocaleToJellyfinLanguage(rokuLocale) → {string}
mapRokuLocaleToJellyfinLanguage: Converts Roku locale codes to Jellyfin ISO 639-2 language codes
Maps Roku device locale (e.g., "en_US", "fr_CA") to Jellyfin's 3-letter language codes. Extracts base language from locale and maps to standard ISO 639-2 codes.
Supported Roku locales:
- en_US, en_GB, en_CA, en_AU → eng (English)
- es_ES, es_MX → spa (Spanish)
- pt_BR → por (Portuguese)
- fr_CA → fra (French)
- de_DE → deu (German)
- it_IT → ita (Italian)
| Name | Type | Description |
|---|---|---|
rokuLocale | dynamic | Roku locale string (e.g., "en_US", "fr_CA") |
- Jellyfin ISO 639-2 language code (e.g., "eng", "fra"), or empty string if not recognized
- Type:
- string
(static) resolvePlayDefaultAudioTrack(userSettings, userConfig) → {boolean}
resolvePlayDefaultAudioTrack: Resolves the playDefaultAudioTrack setting value
Checks JellyRock override setting first, then falls back to web client setting. Ensures a valid boolean is always returned.
| Name | Type | Description |
|---|---|---|
userSettings | object | JellyfinUserSettings node (JellyRock settings) |
userConfig | object | JellyfinUserConfiguration node (web client settings) |
- Resolved playDefaultAudioTrack value (guaranteed boolean)
- Type:
- boolean
(static) selectBestStreamByHardware(audioStreams, deviceCapabilities) → {dynamic}
selectBestStreamByHardware: Selects the best audio stream based on device capabilities
Priority:
- Prefer streams matching device's max channel capability (for quality)
- Among matching streams, prefer direct-playable codecs
- Fall back intelligently based on channel counts
| Name | Type | Description |
|---|---|---|
audioStreams | object | Array of audio stream objects |
deviceCapabilities | object | Device capability info from getDeviceAudioCapabilities() |
- Best matching audio stream object, or invalid
- Type:
- dynamic