new HlsTs(optsnullable)
Create an HLS TS parser
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
HlsTsOptions |
<nullable> |
- Source:
Example
var parser = new window.HlsTs({ debug: false });
parser.parse(data).then(function() {
var avcPayload = parser.getDataStreamByProgramType("avc");
});
Methods
createAvcParser(dataStream) → {AVCParser}
Create an AVC Parser that can parse an AVC data stream
Parameters:
Name | Type | Description |
---|---|---|
dataStream |
HlsTsDataStream |
- Source:
Returns:
- Type
- AVCParser
Example
var parser = new window.HlsTs();
parser.parse(data).then(function() {
var avcParser = parser.createAvcParser(parser.getDataStreamByProgramType("avc"));
var nalUnits = avcParser.getNalUnits();
});
getDataStreamByProgramType(type) → {HlsTsDataStream}
Get the data stream for a program type
Parameters:
Name | Type | Description |
---|---|---|
type |
string | Program type e.g: "avc" or "aac" |
- Source:
Returns:
- Type
- HlsTsDataStream
getPacketsByProgramType(type) → {Array.<HlsTsPacket>}
Get all packets for a specific program type
Parameters:
Name | Type | Description |
---|---|---|
type |
string | Program type e.g: "avc" or "aac" |
- Source:
Returns:
- Type
- Array.<HlsTsPacket>
getPrograms() → {Array.<HlsTsProgramType>}
Get the parsed program types
- Source:
Returns:
- Type
- Array.<HlsTsProgramType>
parse(data) → {Promise}
Parse HLS TS data
Parameters:
Name | Type | Description |
---|---|---|
data |
Uint8Array | The data to parse |
- Source:
Returns:
Resolves when data is parsed
- Type
- Promise