Home Reference Source
import Hls from 'hls.js/src/hls.ts'
public class | source

Hls

Extends:

src/observer.js~Observer → Hls

Static Member Summary

Static Public Members
public static get

DefaultConfig: HlsConfig

public static set

DefaultConfig: HlsConfig

public static get

ErrorDetails: HlsErrorDetails

public static get

ErrorTypes: HlsErrorTypes

public static get
public static get

Static Method Summary

Static Public Methods
public static

Constructor Summary

Public Constructor
public

constructor(config: HlsConfig)

Creates an instance of an HLS client that can attach to exactly one HTMLMediaElement.

Member Summary

Public Members
public get

index of the selected audio track (index in audio track lists)

public set

selects an audio track, based on its index in audio track lists

public
public get

audioTracks: AudioTrack[]

public get

Capping/max level value that should be used by automatic level selection algorithm (ABRController)

public set

Capping/max level value that should be used by automatic level selection algorithm (ABRController)

public get

True when automatic level selection enabled

public get

get bandwidth estimate

public set

set dynamically set capLevelToPlayerSize against (CapLevelController)

public

config: {...defaultConfig: Object, ...userConfig: Object}

public
public get

Index of quality level currently played

public set

Set quality level index immediately .

public
public get

Return "first level": like a default level, if not set, falls back to index of first level referenced in manifest

public set

Sets "first-level", see getter.

public get

levels: QualityLevel[]

public get

liveSyncPosition: Seconds

public get

Return the quality level of the currently or last (of none is loaded currently) segment

public set

Set quality level index for next loaded data in a conservative way.

public get

Level set manually (if any)

public get

max level selectable in auto mode according to autoLevelCapping

public

media: *

public get

min level selectable in auto mode according to config.minAutoBitrate

public
public get

next automatically selected quality level

public set

this setter is used to force next auto level.

public get

Index of next quality level loaded as scheduled by stream controller.

public set

Set quality level index for next loaded data.

public get

get next quality level loaded

public set

Set quality level of next loaded segment in a fully "non-destructive" way.

public get

Return start level (level of first fragment that will be played back) if not overrided by user, first level appearing in manifest will be used as start level if -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment)

public set

set start level (level of first fragment that will be played back) if not overrided by user, first level appearing in manifest will be used as start level if -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment)

public get
public set

Enable/disable subtitle display rendering

public get

index of the selected subtitle track (index in subtitle track lists)

public set

select an subtitle track, based on its index in subtitle track lists

public
public get

get alternate subtitle tracks list from playlist

public

url: *

Private Members
private

Method Summary

Public Methods
public

attachMedia(media: HTMLMediaElement)

Attach a media element

public

Dispose of the instance

public

Detach from the media

public

Set the source URL.

public

When the media-element fails, this allows to detach and then re-attach it as one call (convenience method).

public

removeLevel(levelIndex: undefined, urlId: undefined)

Remove a loaded level from the list of levels, or a level url in from a list of redundant level urls.

public

startLoad(startPosition: number)

Start loading data from the stream source.

public

Stop loading of any stream data.

public

Swap through possible audio codecs in the stream (for example to switch from stereo to 5.1)

Static Public Members

public static get DefaultConfig: HlsConfig source

public static set DefaultConfig: HlsConfig source

public static get ErrorDetails: HlsErrorDetails source

public static get ErrorTypes: HlsErrorTypes source

public static get Events: HlsEvents source

public static get version: string source

Static Public Methods

public static isSupported(): *: boolean source

Return:

*

Public Constructors

public constructor(config: HlsConfig) source

Creates an instance of an HLS client that can attach to exactly one HTMLMediaElement.

Params:

NameTypeAttributeDescription
config HlsConfig

Public Members

public get audioTrack: number source

index of the selected audio track (index in audio track lists)

public set audioTrack: number source

selects an audio track, based on its index in audio track lists

public audioTrackController: * source

public get audioTracks: AudioTrack[] source

public get autoLevelCapping: number source

Capping/max level value that should be used by automatic level selection algorithm (ABRController)

public set autoLevelCapping: number source

Capping/max level value that should be used by automatic level selection algorithm (ABRController)

public get autoLevelEnabled: boolean source

True when automatic level selection enabled

public get bandwidthEstimate: number source

get bandwidth estimate

public set capLevelToPlayerSize: boolean source

set dynamically set capLevelToPlayerSize against (CapLevelController)

public config: {...defaultConfig: Object, ...userConfig: Object} source

public coreComponents: * source

public get currentLevel: number source

Index of quality level currently played

public set currentLevel: number source

Set quality level index immediately . This will flush the current buffer to replace the quality asap. That means playback will interrupt at least shortly to re-buffer and re-sync eventually.

public emeController: * source

public get firstLevel: number source

Return "first level": like a default level, if not set, falls back to index of first level referenced in manifest

public set firstLevel: number source

Sets "first-level", see getter.

public get levels: QualityLevel[] source

public get liveSyncPosition: Seconds source

public get loadLevel: number source

Return the quality level of the currently or last (of none is loaded currently) segment

public set loadLevel: number source

Set quality level index for next loaded data in a conservative way. This will switch the quality without flushing, but interrupt current loading. Thus the moment when the quality switch will appear in effect will only be after the already existing buffer.

public get manualLevel: number source

Level set manually (if any)

public get maxAutoLevel: number source

max level selectable in auto mode according to autoLevelCapping

public media: * source

public get minAutoLevel: number source

min level selectable in auto mode according to config.minAutoBitrate

public networkControllers: * source

public get nextAutoLevel: number source

next automatically selected quality level

public set nextAutoLevel: number source

this setter is used to force next auto level. this is useful to force a switch down in auto mode: in case of load error on level N, hls.js can set nextAutoLevel to N-1 for example) forced value is valid for one fragment. upon succesful frag loading at forced level, this value will be resetted to -1 by ABR controller.

public get nextLevel: number source

Index of next quality level loaded as scheduled by stream controller.

public set nextLevel: number source

Set quality level index for next loaded data. This will switch the video quality asap, without interrupting playback. May abort current loading of data, and flush parts of buffer (outside currently played fragment region).

public get nextLoadLevel: number source

get next quality level loaded

public set nextLoadLevel: number source

Set quality level of next loaded segment in a fully "non-destructive" way. Same as loadLevel but will wait for next switch (until current loading is done).

public get startLevel: number source

Return start level (level of first fragment that will be played back) if not overrided by user, first level appearing in manifest will be used as start level if -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment)

public set startLevel: number source

set start level (level of first fragment that will be played back) if not overrided by user, first level appearing in manifest will be used as start level if -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment)

public get subtitleDisplay: boolean source

public set subtitleDisplay: boolean source

Enable/disable subtitle display rendering

public get subtitleTrack: number source

index of the selected subtitle track (index in subtitle track lists)

public set subtitleTrack: number source

select an subtitle track, based on its index in subtitle track lists

public subtitleTrackController: * source

public get subtitleTracks: * source

get alternate subtitle tracks list from playlist

public url: * source

Private Members

private _autoLevelCapping: * source

Public Methods

public attachMedia(media: HTMLMediaElement) source

Attach a media element

Params:

NameTypeAttributeDescription
media HTMLMediaElement

public destroy() source

Dispose of the instance

public detachMedia() source

Detach from the media

public loadSource(url: string) source

Set the source URL. Can be relative or absolute.

Params:

NameTypeAttributeDescription
url string

public recoverMediaError() source

When the media-element fails, this allows to detach and then re-attach it as one call (convenience method).

Automatic recovery of media-errors by this process is configurable.

public removeLevel(levelIndex: undefined, urlId: undefined) source

Remove a loaded level from the list of levels, or a level url in from a list of redundant level urls. This can be used to remove a rendition or playlist url that errors frequently from the list of levels that a user or hls.js can choose from.

Params:

NameTypeAttributeDescription
levelIndex undefined
urlId undefined

public startLoad(startPosition: number) source

Start loading data from the stream source. Depending on default config, client starts loading automatically when a source is set.

Params:

NameTypeAttributeDescription
startPosition number

public stopLoad() source

Stop loading of any stream data.

public swapAudioCodec() source

Swap through possible audio codecs in the stream (for example to switch from stereo to 5.1)