Home Reference Source
import ID3 from 'hls.js/src/demux/id3.js'
public class | source

ID3

ID3 parser

Static Method Summary

Static Public Methods
public static

Returns any adjacent ID3 tags found in data starting at offset, as one block of data

public static

getID3Frames(id3Data: Uint8Array): ID3 frame[]

Returns an array of ID3 frames found in all the ID3 tags in the id3Data

public static

Searches for the Elementary Stream timestamp found in the ID3 data chunk

public static

isFooter(data: Uint8Array, offset: number): boolean

Returns true if an ID3 footer can be found at offset in data

public static

isHeader(data: Uint8Array, offset: number): boolean

Returns true if an ID3 header can be found at offset in data

public static

isTimeStampFrame(frame: ID3 frame): *

Returns true if the ID3 frame is an Elementary Stream timestamp frame

Static Private Methods
private static

_decodeFrame(frame: *): *

private static

_decodePrivFrame(frame: *): {"key": *, "info": *, "data": *}

private static

_decodeTextFrame(frame: *): {"key": *, "data": *}

private static

_decodeURLFrame(frame: *): {"key": *, "data": *}

private static

_getFrameData(data: *): {"type": *, "size": *, "data": *}

private static

_readSize(data: *, offset: *): *

private static

_readTimeStamp(timeStampFrame: *): *

private static

_utf8ArrayToStr(array: *, exitOnNull: boolean): *

Static Public Methods

public static getID3Data(data: Uint8Array, offset: number): Uint8Array source

Returns any adjacent ID3 tags found in data starting at offset, as one block of data

Params:

NameTypeAttributeDescription
data Uint8Array

The data to search in

offset number

The offset at which to start searching

Return:

Uint8Array

The block of data containing any ID3 tags found

public static getID3Frames(id3Data: Uint8Array): ID3 frame[] source

Returns an array of ID3 frames found in all the ID3 tags in the id3Data

Params:

NameTypeAttributeDescription
id3Data Uint8Array

The ID3 data containing one or more ID3 tags

Return:

ID3 frame[]

Array of ID3 frame objects

public static getTimeStamp(data: Uint8Array): number source

Searches for the Elementary Stream timestamp found in the ID3 data chunk

Params:

NameTypeAttributeDescription
data Uint8Array

Block of data containing one or more ID3 tags

Return:

number

The timestamp

public static isFooter(data: Uint8Array, offset: number): boolean source

Returns true if an ID3 footer can be found at offset in data

Params:

NameTypeAttributeDescription
data Uint8Array

The data to search in

offset number

The offset at which to start searching

Return:

boolean

True if an ID3 footer is found

public static isHeader(data: Uint8Array, offset: number): boolean source

Returns true if an ID3 header can be found at offset in data

Params:

NameTypeAttributeDescription
data Uint8Array

The data to search in

offset number

The offset at which to start searching

Return:

boolean

True if an ID3 header is found

public static isTimeStampFrame(frame: ID3 frame): * source

Returns true if the ID3 frame is an Elementary Stream timestamp frame

Params:

NameTypeAttributeDescription
frame ID3 frame

Return:

*

Static Private Methods

private static _decodeFrame(frame: *): * source

Params:

NameTypeAttributeDescription
frame *

Return:

*

private static _decodePrivFrame(frame: *): {"key": *, "info": *, "data": *} source

Params:

NameTypeAttributeDescription
frame *

Return:

{"key": *, "info": *, "data": *}

private static _decodeTextFrame(frame: *): {"key": *, "data": *} source

Params:

NameTypeAttributeDescription
frame *

Return:

{"key": *, "data": *}

private static _decodeURLFrame(frame: *): {"key": *, "data": *} source

Params:

NameTypeAttributeDescription
frame *

Return:

{"key": *, "data": *}

private static _getFrameData(data: *): {"type": *, "size": *, "data": *} source

Params:

NameTypeAttributeDescription
data *

Return:

{"type": *, "size": *, "data": *}

private static _readSize(data: *, offset: *): * source

Params:

NameTypeAttributeDescription
data *
offset *

Return:

*

private static _readTimeStamp(timeStampFrame: *): * source

Params:

NameTypeAttributeDescription
timeStampFrame *

Return:

*

private static _utf8ArrayToStr(array: *, exitOnNull: boolean): * source

Params:

NameTypeAttributeDescription
array *
exitOnNull boolean
  • optional
  • default: false

Return:

*