Methods

(static) findActiveSegment(segments, positionSeconds) → {dynamic}

findActiveSegment: Finds the media segment containing the current playback position.

Linear scan over the segments array (typically 2-5 items). Returns the first segment where StartTicks <= position < EndTicks.

Parameters:
NameTypeDescription
segmentsroArray

Array of MediaSegmentDto objects ({Id, Type, StartTicks, EndTicks})

positionSecondsfloat

Current playback position in seconds

Returns:

The active MediaSegmentDto or invalid if not inside any segment

Type: 
dynamic

(static) findSegmentById(segments, segmentId) → {dynamic}

findSegmentById: Finds a media segment by its Id.

Linear scan over the segments array (typically 2-5 items). Prefer this over caching segment objects, since the segments array can be replaced during content loading (audio/subtitle track changes).

Parameters:
NameTypeDescription
segmentsroArray

Array of MediaSegmentDto objects

segmentIdstring

The segment Id to find

Returns:

The matching MediaSegmentDto or invalid if not found

Type: 
dynamic

(static) resolveSegmentAction(segmentType, userSettings, userConfig) → {string}

resolveSegmentAction: Resolves the action to take for a given media segment type.

Checks JellyRock per-type override setting first, then falls back to web client DisplayPreferences CustomPrefs value, then falls back to built-in defaults.

Built-in defaults: All types = AskToSkip

Parameters:
NameTypeDescription
segmentTypestring

MediaSegmentType value ("Intro", "Outro", etc.)

userSettingsobject

JellyfinUserSettings node (JellyRock settings)

userConfigobject

JellyfinUserConfiguration node (web client settings)

Returns:
  • MediaSegmentAction value ("None", "AskToSkip", "Skip")
Type: 
string

(static) segmentTicksToSeconds(ticks) → {float}

segmentTicksToSeconds: Converts Jellyfin ticks (100-nanosecond units) to seconds.

Parameters:
NameTypeDescription
ticksdynamic

Tick count (10,000,000 ticks = 1 second)

Returns:
  • Position in seconds
Type: 
float

(static) supportsMediaSegments() → {boolean}

supportsMediaSegments: Checks if the connected Jellyfin server supports the MediaSegments API.

The /MediaSegments/{itemId} endpoint was introduced in Jellyfin 10.10.0. Servers below 10.10.0 do not have this endpoint and will return 404.

Returns:
  • true if server supports media segments
Type: 
boolean