Home Reference Source
import GapController from 'hls.js/src/controller/gap-controller.js'
public class | source

GapController

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

config: *

public
public

hls: *

public

media: *

public
public
public
public
public

stalled: *

Method Summary

Public Methods
public

poll(lastCurrentTime: number)

Checks if the playhead is stuck within a gap, and if so, attempts to free it.

Private Methods
private

_reportStall(bufferLen: *)

Triggers a BUFFER_STALLED_ERROR event, but only once per stall period.

private

_tryFixBufferStall(bufferInfo: *, stalledDurationMs: *)

Detects and attempts to fix known buffer stalling issues.

private

Attempts to fix buffer stalls by advancing the mediaElement's current time by a small amount.

private

_trySkipBufferHole(partial: *): number

Attempts to fix buffer stalls by jumping over known gaps caused by partial fragments

Public Constructors

public constructor() source

Public Members

public config: * source

public fragmentTracker: * source

public hls: * source

public media: * source

public moved: boolean source

public nudgeRetry: number source

public seeking: boolean source

public stallReported: boolean source

public stalled: * source

Public Methods

public poll(lastCurrentTime: number) source

Checks if the playhead is stuck within a gap, and if so, attempts to free it. A gap is an unbuffered range between two buffered ranges (or the start and the first buffered range).

Params:

NameTypeAttributeDescription
lastCurrentTime number

Previously read playhead position

Private Methods

private _reportStall(bufferLen: *) source

Triggers a BUFFER_STALLED_ERROR event, but only once per stall period.

Params:

NameTypeAttributeDescription
bufferLen *

The playhead distance from the end of the current buffer segment.

private _tryFixBufferStall(bufferInfo: *, stalledDurationMs: *) source

Detects and attempts to fix known buffer stalling issues.

Params:

NameTypeAttributeDescription
bufferInfo *

The properties of the current buffer.

stalledDurationMs *

The amount of time Hls.js has been stalling for.

private _tryNudgeBuffer() source

Attempts to fix buffer stalls by advancing the mediaElement's current time by a small amount.

private _trySkipBufferHole(partial: *): number source

Attempts to fix buffer stalls by jumping over known gaps caused by partial fragments

Params:

NameTypeAttributeDescription
partial *

The partial fragment found at the current time (where playback is stalling).

Return:

number