Constructor
new TsParser()
Members
H264_NALU_TYPE_SPS_ :number
NALU type for Sequence Parameter Set (SPS) for H.264.
Type:
- number
- Source:
H265_NALU_TYPE_SPS_ :number
NALU type for Sequence Parameter Set (SPS) for H.265.
Type:
- number
- Source:
PROFILES_WITH_OPTIONAL_SPS_DATA_ :Array.<number>
Values of profile_idc that indicate additional fields are included in the
SPS.
see Recommendation ITU-T H.264 (4/2013)
7.3.2.1.1 Sequence parameter set data syntax
Type:
- Array.<number>
- Source:
Methods
probe(data) → {boolean}
Check if the passed data corresponds to an MPEG2-TS
Parameters:
Name | Type | Description |
---|---|---|
data |
Uint8Array |
- Source:
Returns:
- Type
- boolean
syncOffset(data) → {number}
Returns the synchronization offset
Parameters:
Name | Type | Description |
---|---|---|
data |
Uint8Array |
- Source:
Returns:
- Type
- number
byteToHex_(x) → {string}
Convert a byte to 2 digits of hex. (Only handles values 0-255.)
Parameters:
Name | Type | Description |
---|---|---|
x |
number |
- Source:
Returns:
- Type
- string
getAudioData() → {Array.<shaka.extern.MPEG_PES>}
Return the audio data
- Source:
Returns:
- Type
- Array.<shaka.extern.MPEG_PES>
getAvcInfo_() → {{height: ?string, width: ?string, codec: ?string}}
Return the video information for AVC
- Source:
Returns:
- Type
- {height: ?string, width: ?string, codec: ?string}
getCodecs() → {{audio: ?string, video: ?string}}
Return the audio and video codecs
- Source:
Returns:
- Type
- {audio: ?string, video: ?string}
getHvcInfo_() → {{height: ?string, width: ?string, codec: ?string}}
Return the video information for HVC
- Source:
Returns:
- Type
- {height: ?string, width: ?string, codec: ?string}
getMetadata() → {Array.<shaka.extern.ID3Metadata>}
Return the ID3 metadata
- Source:
Returns:
- Type
- Array.<shaka.extern.ID3Metadata>
getPmtId_(data, offset) → {number}
Get the PMT ID from the PAT
Parameters:
Name | Type | Description |
---|---|---|
data |
Uint8Array | |
offset |
number |
- Source:
Returns:
- Type
- number
getStartTime() → {{audio: ?number, video: ?number}}
Return the start time for the audio and video
- Source:
Returns:
- Type
- {audio: ?number, video: ?number}
getVideoData() → {Array.<shaka.extern.MPEG_PES>}
Return the audio data
- Source:
Returns:
- Type
- Array.<shaka.extern.MPEG_PES>
getVideoInfo() → {{height: ?string, width: ?string, codec: ?string}}
Return the video information
- Source:
Returns:
- Type
- {height: ?string, width: ?string, codec: ?string}
getVideoNalus() → {Array.<shaka.extern.VideoNalu>}
Return the video data
- Source:
Returns:
- Type
- Array.<shaka.extern.VideoNalu>
getVideoResolution() → {{height: ?string, width: ?string}}
Return the video resolution
- Source:
Returns:
- Type
- {height: ?string, width: ?string}
parse(data) → {shaka.util.TsParser}
Parse the given data
Parameters:
Name | Type | Description |
---|---|---|
data |
Uint8Array |
- Source:
Returns:
- Type
- shaka.util.TsParser
parseAvcNalus(pes, nextPesopt, nullable) → {Array.<shaka.extern.VideoNalu>}
Parse AVC Nalus
The code is based on hls.js
Credit to https://github.com/video-dev/hls.js/blob/master/src/demux/tsdemuxer.ts
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pes |
shaka.extern.MPEG_PES | ||
nextPes |
shaka.extern.MPEG_PES |
<optional> <nullable> |
- Source:
Returns:
- Type
- Array.<shaka.extern.VideoNalu>
parseNalus(pes, nextPesopt, nullable, lastNaluopt, nullable) → {Array.<shaka.extern.VideoNalu>}
Parse AVC and HVC Nalus
The code is based on hls.js
Credit to https://github.com/video-dev/hls.js/blob/master/src/demux/tsdemuxer.ts
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pes |
shaka.extern.MPEG_PES | ||
nextPes |
shaka.extern.MPEG_PES |
<optional> <nullable> |
|
lastNalu |
shaka.extern.VideoNalu |
<optional> <nullable> |
- Source:
Returns:
- Type
- Array.<shaka.extern.VideoNalu>
parsePES_(data) → {shaka.extern.MPEG_PES}
Parse PES
Parameters:
Name | Type | Description |
---|---|---|
data |
Uint8Array |
- Source:
Returns:
parsePMT_(data, offset) → {shaka.util.TsParser.PMT}
Parse PMT
Parameters:
Name | Type | Description |
---|---|---|
data |
Uint8Array | |
offset |
number |
- Source:
Returns:
Type Definitions
PMT
PMT.
Type:
- {audio: number, video: number, id3: number, audioCodec: string, videoCodec: string}
Properties:
Name | Type | Description |
---|---|---|
audio |
number | Audio PID |
video |
number | Video PID |
id3 |
number | ID3 PID |
audioCodec |
string | Audio codec |
videoCodec |
string | Video codec |
- Source: