Members

(static, constant) SEGMENT_SKIP_END_OF_MEDIA_SECONDS

How close to the end of the media a skip may land before it counts as reaching the end.

Default Value
  • 5

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) resolveEffectiveSegmentAction(segmentType, userSettings, userConfig, alreadySkipped) → {string}

resolveEffectiveSegmentAction: Resolves the action for a segment, accounting for whether it has already been auto-skipped this playback session.

A Skip-configured segment auto-seeks only on its first pass. Once skipped, rewinding back into it must not re-skip (that would trap the user in a rewind loop), but the user should still get the manual Skip button. So an already-skipped Skip segment degrades to AskToSkip; all other actions pass through unchanged.

Parameters:
NameTypeDescription
segmentTypestring

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

userSettingsobject

JellyfinUserSettings node (JellyRock settings)

userConfigobject

JellyfinUserConfiguration node (web client settings)

alreadySkippedboolean

true if this segment already auto-skipped this session

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

(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) skipEndsPlayback(segmentEndSeconds, durationSeconds) → {boolean}

skipEndsPlayback: Whether skipping to a segment's end would leave nothing left to play.

A skip seeks to the segment's end. When that is at or near the end of the media, the stream has nothing left to buffer: the player sits in buffering until the stall check reports a playback error, instead of ever reaching finished and moving on. So the caller finishes playback rather than seeking.

Independent of the segment TYPE on purpose. Any segment can run to the end of the file (a Preview after the Outro, credits, a commercial), and what makes the seek unplayable is where it lands, not what the segment was called.

Parameters:
NameTypeDescription
segmentEndSecondsfloat

Where the skip would seek to

durationSecondsfloat

Media duration; 0 or less when unknown

Returns:
  • true to finish playback, false to seek
Type: 
boolean

(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