Members
(static, constant) BUFFER_SAFETY_FACTOR
Percentage of buffer available for segment data (leaves room for metadata/overhead). Combined with BUFFER_SEGMENT_COUNT=2, each segment is allocated 37.5% of the total buffer.
- Default Value
- 0.75
(static, constant) BUFFER_SEGMENT_COUNT
Number of segments the buffer must hold simultaneously. Roku's player buffers multiple segments for look-ahead playback. The buffer must fit at least this many segments concurrently.
- Default Value
- 2
(static, constant) DEVICE_BUFFER_SIZE_LOW_MEMORY
Video buffer size for 512MB RAM devices (from error logs: max_wrap_allocation)
- Default Value
- 20553728
(static, constant) DEVICE_BUFFER_SIZE_NORMAL
Video buffer size for all other devices (from error logs: entire buffer size)
- Default Value
- 31616000
(static, constant) MAX_HLS_PLAYLIST_ENTRIES
Max HLS playlist entries before Roku's MPR rejects the playlist as too large. Exact Roku limit is undocumented - this is a conservative estimate. Tune this value based on testing if "mpr playlist file is too large" errors occur.
- Default Value
- 5000
Methods
(static) GetBitRateLimit(codec) → {object}
| Name | Type | Description |
|---|---|---|
codec | string |
- Type:
- object
(static) GetDirectPlayProfiles() → {object}
- Type:
- object
(static) applyResolutionCapToProfile(codecProfile, maxHeight, maxWidth, isRequiredopt) → {void}
Apply a paired Height + Width resolution cap to a codec profile's Conditions. No-ops if a Height condition at or below maxHeight already exists.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
codecProfile | object | {object} - The codec profile AA containing a Conditions array | ||
maxHeight | integer | {integer} - The max height to cap at (e.g. 1080) | ||
maxWidth | integer | {integer} - The max width to cap at (e.g. 1920) | ||
isRequired | boolean | <optional> | false | {boolean} - Whether the condition is required for direct play |
- Type:
- void
(static) calculateOptimalTranscodingParams(bitrateBps, videoDurationSeconds, bufferSizeBytes) → {object}
Calculates optimal HLS transcoding parameters to prevent buffer overflow and playlist errors.
Solves two constraints simultaneously:
- Buffer: (bitrate × segmentDuration) / 8 ≤ bufferSize × BUFFER_SAFETY_FACTOR
- Playlist: videoDuration / segmentDuration ≤ MAX_HLS_PLAYLIST_ENTRIES
Targets 6s segments for optimal startup and seek performance. Goes shorter if the buffer forces it, or longer (up to 9s) only when the playlist constraint requires it. Only reduces bitrate as a last resort when no segment length satisfies both constraints.
segmentLength: optimal HLS segment duration (1-9 seconds) maxBitrate: max streaming bitrate in bps (0 = no reduction needed)
| Name | Type | Description |
|---|---|---|
bitrateBps | LongInteger | Source media total bitrate in bits per second |
videoDurationSeconds | Integer | Video duration in seconds |
bufferSizeBytes | LongInteger | Device video buffer size in bytes |
{ segmentLength: Integer, maxBitrate: LongInteger }
- Type:
- object
(static) canDeviceDecodeCodec(codec, channelCount) → {boolean}
Test if device can decode a specific codec at a given channel count This is a public wrapper for getActualCodecSupport that can be called from other files Returns true if the Roku can decode this codec at this channel count
| Name | Type | Description |
|---|---|---|
codec | string | |
channelCount | integer |
- Type:
- boolean
(static) canPlay4k() → {boolean}
does this roku device support playing 4k video?
- Type:
- boolean
(static) convertHevcLevelToString(level) → {string}
Convert HEVC level from float format (e.g., 5.0, 5.1, 4.1) to Jellyfin string format HEVC levels are multiplied by 30 to convert to the integer representation Examples: 5.0 → "150", 5.1 → "153", 4.1 → "123"
| Name | Type | Description |
|---|---|---|
level | float |
- Type:
- string
(static) filterCodecProfileConditions(codecProfiles, propertiesToRemove) → {object}
filterCodecProfileConditions: Removes conditions with specified properties from codec profiles Used for version compatibility - e.g., removing VideoRangeType for pre-10.9 servers
| Name | Type | Description |
|---|---|---|
codecProfiles | array | Array of codec profile objects |
propertiesToRemove | array | Array of property names to filter out |
Filtered codec profiles
- Type:
- object
(static) getActualCodecSupport(codec, channelCount, di) → {boolean}
Override false positives from Roku API using known hardware limits Returns true if codec can actually decode/passthrough the specified channel count For surround codecs (>2ch), prioritizes PassThru check to detect receiver support Accepts Jellyfin codec names (e.g. "truehd") and translates to Roku API names internally
| Name | Type | Description |
|---|---|---|
codec | string | |
channelCount | integer | |
di | object |
- Type:
- boolean
(static) getCodecProfiles() → {object}
- Type:
- object
(static) getContainerProfiles() → {object}
- Type:
- object
(static) getDeviceBufferSize() → {longinteger}
Returns the device's video buffer size in bytes. 512MB RAM devices have a smaller buffer than all other devices.
Buffer size in bytes
- Type:
- longinteger
(static) getDeviceCapabilities() → {object}
Returns the Device Capabilities for Roku. Also prints out the device profile for debugging
- Type:
- object
(static) getDeviceProfile() → {object}
- Type:
- object
(static) getDeviceProfileV1(globalDevice) → {object}
V1 DeviceProfile for Jellyfin 10.7.x - 10.8.x servers Uses the full DeviceProfile format with Identification object
| Name | Type | Description |
|---|---|---|
globalDevice | object |
- Type:
- object
(static) getDeviceProfileV2(globalDevice) → {object}
V2 DeviceProfile for Jellyfin 10.9+ servers Uses the simplified DeviceProfile format without Identification object
| Name | Type | Description |
|---|---|---|
globalDevice | object |
- Type:
- object
(static) getResolutionConditions(isRequiredopt) → {object}
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
isRequired | boolean | <optional> | false |
- Type:
- object
(static) getSubtitleProfiles() → {object}
- Type:
- object
(static) getSupportedPassthruCodecs(di, channelCount) → {object}
Get list of surround codecs that support passthrough, returned as Jellyfin codec strings. Returns array in priority order: eac3, ac3, dts, truehd, dtshd
Two groups due to differing Roku API behaviour: Group 1 (ChCnt-aware): eac3, ac3, dts, mat — checked with ChCnt + PassThru: 1 Group 2 (ChCnt N/A): dtshd — checked with PassThru: 1 only
mat is the Roku API name for TrueHD/Dolby MAT; returned here as "truehd" (Jellyfin name). dtsx (DTS:X) is an extension of DTS-HD MA — covered by dtshd; not added separately.
| Name | Type | Description |
|---|---|---|
di | object | |
channelCount | integer |
- Type:
- object
(static) getTranscodingProfiles() → {object}
- Type:
- object
(static) jellyfinToRokuCodecName(codec) → {string}
Translate Jellyfin codec names to Roku API codec names where they differ. Covers both audio and video codecs. "h264" → "mpeg4 avc" (Jellyfin uses "h264"; Roku API uses "mpeg4 avc" with a space) "truehd" → "mat" (TrueHD/Dolby MAT — "truehd" is unknown to the Roku API) "mpeg1video"→ "mpeg1" (Jellyfin uses "mpeg1video"; Roku API uses "mpeg1")
| Name | Type | Description |
|---|---|---|
codec | string |
- Type:
- string
(static) removeDecimals(value) → {string}
Remove all decimals from a string
| Name | Type | Description |
|---|---|---|
value | string |
- Type:
- string
(static) updateProfileArray(profileArray, videoCodec, videoProfile, profileLevelopt) → {object}
Receives and returns an assArray of supported profiles and levels for each video codec
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
profileArray | object | |||
videoCodec | string | |||
videoProfile | string | |||
profileLevel | string | <optional> | "" |
- Type:
- object