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

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 set

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

public get

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

public get

True when automatic level selection enabled

public

config: *

public
public set

Set quality level index immediately .

public get

Index of quality level currently played

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 set

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

public get

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

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 set

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

public get

get next quality level loaded

public

off: *

public

on: *

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

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 get

subtitleDisplay: booelan

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 @type{number}

public
public get

subtitleTracks: SubtitleTrack[]

get alternate subtitle tracks list from playlist

public

trigger: *

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

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 set autoLevelCapping: number source

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

public get 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 config: * source

public coreComponents: * source

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 get currentLevel: number source

Index of quality level currently played

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 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 loadLevel: number source

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

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 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 nextLoadLevel: number source

get next quality level loaded

public off: * source

public on: * source

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 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 get subtitleDisplay: booelan 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 source

select an subtitle track, based on its index in subtitle track lists @type{number}

public subtitleTrackController: * source

public get subtitleTracks: SubtitleTrack[] source

get alternate subtitle tracks list from playlist

public trigger: * source

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 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

Set the start position to stream from

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)