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

FragmentTracker

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public
public
public

fragments: Partial

public

hls: Hls

public

Method Summary

Public Methods
public

backtrack(frag: Fragment, data: FragLoadedData): *

public
public

detectEvictedFragments(elementaryStream: SourceBufferName, timeRange: TimeRanges, playlistType: PlaylistLevelType)

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

detectPartialFragments(data: FragBufferedData)

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

public
public

getAppendedFrag(position: number, levelType: PlaylistLevelType): *

Return a Fragment with an appended range that matches the position and levelType.

public

getBacktrackData(fragment: Fragment): *

public

getBufferedFrag(position: number, levelType: PlaylistLevelType): *

Return a buffered Fragment that matches the position and levelType.

public

getBufferedTimes(fragment: Fragment, part: undefined, partial: boolean, timeRange: TimeRanges): FragmentBufferedRange

public

Gets the partial fragment for a certain time

public

getState(fragment: Fragment): FragmentState

public
public

isTimeBuffered(startPTS: number, endPTS: number, timeRange: TimeRanges): boolean

public

onBufferAppended(event: undefined, data: BufferAppendedData)

public

onFragBuffered(event: undefined, data: FragBufferedData)

public

onFragLoaded(event: undefined, data: FragLoadedData)

public
public
public

removeFragmentsInRange(start: number, end: number, playlistType: PlaylistLevelType)

Private Methods
private
private

Public Constructors

public constructor() source

Public Members

public activeFragment: * source

public activeParts: * source

public bufferPadding: number source

public fragments: Partial source

public hls: Hls source

public timeRanges: * source

Public Methods

public backtrack(frag: Fragment, data: FragLoadedData): * source

Params:

NameTypeAttributeDescription
frag Fragment
data FragLoadedData

Return:

*

public destroy() source

public detectEvictedFragments(elementaryStream: SourceBufferName, timeRange: TimeRanges, playlistType: PlaylistLevelType) 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 SourceBufferName
timeRange TimeRanges
playlistType PlaylistLevelType

public detectPartialFragments(data: FragBufferedData) 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
data FragBufferedData

public fragBuffered(frag: Fragment) source

Params:

NameTypeAttributeDescription
frag Fragment

public getAppendedFrag(position: number, levelType: PlaylistLevelType): * source

Return a Fragment with an appended range that matches the position and levelType. If not found any Fragment, return null

Params:

NameTypeAttributeDescription
position number
levelType PlaylistLevelType

Return:

*

public getBacktrackData(fragment: Fragment): * source

Params:

NameTypeAttributeDescription
fragment Fragment

Return:

*

public getBufferedFrag(position: number, levelType: PlaylistLevelType): * source

Return a buffered Fragment that matches the position and levelType. A buffered Fragment is one whose loading, parsing and appending is done (completed or "partial" meaning aborted). If not found any Fragment, return null

Params:

NameTypeAttributeDescription
position number
levelType PlaylistLevelType

Return:

*

public getBufferedTimes(fragment: Fragment, part: undefined, partial: boolean, timeRange: TimeRanges): FragmentBufferedRange source

Params:

NameTypeAttributeDescription
fragment Fragment
part undefined
partial boolean
timeRange TimeRanges

Return:

FragmentBufferedRange

public getPartialFragment(time: number): * source

Gets the partial fragment for a certain time

Params:

NameTypeAttributeDescription
time number

Return:

*

public getState(fragment: Fragment): FragmentState source

Params:

NameTypeAttributeDescription
fragment Fragment

Return:

FragmentState

public hasFragment(fragment: Fragment): boolean source

Params:

NameTypeAttributeDescription
fragment Fragment

Return:

boolean

public isTimeBuffered(startPTS: number, endPTS: number, timeRange: TimeRanges): boolean source

Params:

NameTypeAttributeDescription
startPTS number
endPTS number
timeRange TimeRanges

Return:

boolean

public onBufferAppended(event: undefined, data: BufferAppendedData) source

Params:

NameTypeAttributeDescription
event undefined
data BufferAppendedData

public onFragBuffered(event: undefined, data: FragBufferedData) source

Params:

NameTypeAttributeDescription
event undefined
data FragBufferedData

public onFragLoaded(event: undefined, data: FragLoadedData) source

Params:

NameTypeAttributeDescription
event undefined
data FragLoadedData

public removeAllFragments() source

public removeFragment(fragment: Fragment) source

Params:

NameTypeAttributeDescription
fragment Fragment

public removeFragmentsInRange(start: number, end: number, playlistType: PlaylistLevelType) source

Params:

NameTypeAttributeDescription
start number
end number
playlistType PlaylistLevelType

Private Methods

private _registerListeners() source

private _unregisterListeners() source