trickplay

Methods

(static) buildConfigFromMetadata(itemMeta, videoID, deviceWidth, initialPosition) → {dynamic}

buildConfigFromMetadata: Extracts and validates trickplay config from item metadata

Provides fail-fast validation at config creation time rather than at usage time. Reusable across all content types (movies, episodes, live TV, recordings, etc.)

Parameters:
NameTypeDescription
itemMetaobject

Item metadata from ItemMetaData()

videoIDstring

Video item ID

deviceWidthinteger

Device max video width for resolution selection

initialPositioninteger

Starting playback position in seconds

Returns:
  • Valid config object or invalid if trickplay unavailable/invalid
Type: 
dynamic

(static) buildTrickplayCachePath(videoID, width, tileIndex) → {string}

Builds the cachefs:/ path for storing a trickplay tile

Parameters:
NameTypeDescription
videoIDString

Jellyfin video item ID

widthInteger

Resolution width of trickplay images

tileIndexInteger

Zero-based tile index

Returns:
  • cachefs:/ file path
Type: 
string

(static) buildTrickplayUrl(videoID, width, tileIndex) → {string}

Builds the Jellyfin API URL for a trickplay tile

Parameters:
NameTypeDescription
videoIDString

Jellyfin video item ID

widthInteger

Resolution width of trickplay images

tileIndexInteger

Zero-based tile index

Returns:
  • API endpoint path
Type: 
string

(static) calculateClippingRect(thumbnailIndex, tileWidth, tileHeight, thumbWidth, thumbHeight) → {object}

Calculates the clipping rectangle within a tile for a specific thumbnail

Parameters:
NameTypeDescription
thumbnailIndexInteger

Zero-based thumbnail index

tileWidthInteger

Number of thumbnails per row in tile

tileHeightInteger

Number of thumbnail rows in tile

thumbWidthInteger

Width of individual thumbnail in pixels

thumbHeightInteger

Height of individual thumbnail in pixels

Returns:
  • {x, y, width, height} clipping rectangle
Type: 
object

(static) calculateThumbnailIndex(position, interval) → {integer}

Calculates which thumbnail index corresponds to a given video position

Parameters:
NameTypeDescription
positionFloat

Current video position in seconds

intervalInteger

Milliseconds between thumbnails

Returns:
  • Zero-based thumbnail index
Type: 
integer

(static) calculateTileIndex(thumbnailIndex, tileWidth, tileHeight) → {integer}

Calculates which tile contains a given thumbnail index

Parameters:
NameTypeDescription
thumbnailIndexInteger

Zero-based thumbnail index

tileWidthInteger

Number of thumbnails per row in tile

tileHeightInteger

Number of thumbnail rows in tile

Returns:
  • Zero-based tile index
Type: 
integer

(static) selectBestResolution(trickplayData, deviceWidth) → {dynamic}

Selects the best trickplay resolution based on device capabilities SD (720p) uses smallest available, FHD (1920p) uses largest, scales between

Parameters:
NameTypeDescription
trickplayDataObject

Trickplay data object with width keys (e.g., {"320": {...}, "640": {...}})

deviceWidthInteger

Device max video width (e.g., 1920 for FHD, 720 for SD)

Returns:
  • Best width key to use, or invalid if no data available
Type: 
dynamic

(static) thumbnailIndexToPosition(index, interval) → {float}

Converts a thumbnail index to video position in seconds

Parameters:
NameTypeDescription
indexInteger

Zero-based thumbnail index

intervalInteger

Milliseconds between thumbnails

Returns:
  • Video position in seconds
Type: 
float

(static) validateConfig(config) → {boolean}

validateConfig: Validates trickplay configuration object

Ensures all required fields exist and have valid values. Numeric fields must be positive.

Parameters:
NameTypeDescription
configobject

Config object to validate

Returns:
  • True if valid, false otherwise
Type: 
boolean