Home Reference Source
import {FragmentTracker} from 'hls.js/src/helper/fragment-tracker.js'
public class | source

FragmentTracker

Extends:

EventHandler → FragmentTracker

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public

config: *

public
public

Method Summary

Public Methods
public
public

detectEvictedFragments(elementaryStream: String, timeRange: TimeRanges)

Partial fragments effected by coded frame eviction will be removed The browser will unload parts of the buffer to free up memory for new buffer data Fragments will need to be reloaded when the buffer is freed up, removing partial fragments will allow them to reload(since there might be parts that are still playable)

public

Checks if the fragment passed in is loaded in the buffer properly Partially loaded fragments will be registered as a partial fragment

public

getBufferedFrag(position: number, levelType: LevelType): Fragment | null

Return a Fragment that match the position and levelType.

public

getBufferedTimes(startPTS: *, endPTS: *, timeRange: *): {"time": *, "partial": *}

public

getFragmentKey(fragment: *): string

public

Gets the partial fragment for a certain time

public

getState(fragment: Object): String

public

hasFragment(fragment: Object): boolean

Return true if fragment tracker has the fragment.

public

isPartial(fragmentEntity: *): *

public

isTimeBuffered(startPTS: *, endPTS: *, timeRange: *): boolean

public

Fires when the buffer is updated

public

Fires after a fragment has been loaded into the source buffer

public

onFragLoaded(e: *)

Fires when a fragment loading is completed

public

Remove all fragments from fragment tracker.

public

removeFragment(fragment: Object)

Remove a fragment from fragment tracker until it is loaded again

Inherited Summary

From class EventHandler
public
public

hls: *

public
public
public
public

onEvent(event: *, data: *)

arguments: event (string), data (any)

public

onEventGeneric(event: *, data: *)

public
public
public
public

Public Constructors

public constructor() source

Override:

EventHandler#constructor

Public Members

public bufferPadding: number source

public config: * source

public fragments: * source

public timeRanges: * source

Public Methods

public destroy() source

Override:

EventHandler#destroy

public detectEvictedFragments(elementaryStream: String, timeRange: TimeRanges) source

Partial fragments effected by coded frame eviction will be removed The browser will unload parts of the buffer to free up memory for new buffer data Fragments will need to be reloaded when the buffer is freed up, removing partial fragments will allow them to reload(since there might be parts that are still playable)

Params:

NameTypeAttributeDescription
elementaryStream String

The elementaryStream of media this is (eg. video/audio)

timeRange TimeRanges

TimeRange object from a sourceBuffer

public detectPartialFragments(fragment: Object) source

Checks if the fragment passed in is loaded in the buffer properly Partially loaded fragments will be registered as a partial fragment

Params:

NameTypeAttributeDescription
fragment Object

Check the fragment against all sourceBuffers loaded

public getBufferedFrag(position: number, levelType: LevelType): Fragment | null source

Return a Fragment that match the position and levelType. If not found any Fragment, return null

Params:

NameTypeAttributeDescription
position number
levelType LevelType

Return:

Fragment | null

public getBufferedTimes(startPTS: *, endPTS: *, timeRange: *): {"time": *, "partial": *} source

Params:

NameTypeAttributeDescription
startPTS *
endPTS *
timeRange *

Return:

{"time": *, "partial": *}

public getFragmentKey(fragment: *): string source

Params:

NameTypeAttributeDescription
fragment *

Return:

string

public getPartialFragment(time: Number): Object source

Gets the partial fragment for a certain time

Params:

NameTypeAttributeDescription
time Number

Return:

Object

fragment Returns a partial fragment at a time or null if there is no partial fragment

public getState(fragment: Object): String source

Params:

NameTypeAttributeDescription
fragment Object

The fragment to check

Return:

String

Returns the fragment state when a fragment never loaded or if it partially loaded

public hasFragment(fragment: Object): boolean source

Return true if fragment tracker has the fragment.

Params:

NameTypeAttributeDescription
fragment Object

Return:

boolean

public isPartial(fragmentEntity: *): * source

Params:

NameTypeAttributeDescription
fragmentEntity *

Return:

*

public isTimeBuffered(startPTS: *, endPTS: *, timeRange: *): boolean source

Params:

NameTypeAttributeDescription
startPTS *
endPTS *
timeRange *

Return:

boolean

public onBufferAppended(e: *) source

Fires when the buffer is updated

Params:

NameTypeAttributeDescription
e *

public onFragBuffered(e: *) source

Fires after a fragment has been loaded into the source buffer

Params:

NameTypeAttributeDescription
e *

public onFragLoaded(e: *) source

Fires when a fragment loading is completed

Params:

NameTypeAttributeDescription
e *

public removeAllFragments() source

Remove all fragments from fragment tracker.

public removeFragment(fragment: Object) source

Remove a fragment from fragment tracker until it is loaded again

Params:

NameTypeAttributeDescription
fragment Object

The fragment to remove