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:
audioData_ :Array<!Array<Uint8Array>>
Type:
- Array<!Array<Uint8Array>>
- Source:
id3Data_ :Array<!Array<Uint8Array>>
Type:
- Array<!Array<Uint8Array>>
- Source:
videoData_ :Array<!Array<Uint8Array>>
Type:
- Array<!Array<Uint8Array>>
- 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, frameRate: ?string}}
    Return the video information for AVC
- Source:
Returns:
- Type
- {height: ?string, width: ?string, codec: ?string, frameRate: ?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, frameRate: ?string}}
    Return the video information for HVC
- Source:
Returns:
- Type
- {height: ?string, width: ?string, codec: ?string, frameRate: ?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(contentType) → {number}
    Return the start time for the audio and video
    Parameters:
| Name | Type | Description | 
|---|---|---|
| contentType | string | 
- Source:
Returns:
- Type
- number
getVideoData(naluProcessingopt) → {Array<shaka.extern.MPEG_PES>}
    Return the video data
    Parameters:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
| naluProcessing | boolean | <optional> | true | 
- Source:
Returns:
- Type
- Array<shaka.extern.MPEG_PES>
getVideoInfo() → {{height: ?string, width: ?string, codec: ?string, frameRate: ?string}}
    Return the video information
- Source:
Returns:
- Type
- {height: ?string, width: ?string, codec: ?string, frameRate: ?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}
handleRollover_(value, reference) → {number}
Parameters:
| Name | Type | Description | 
|---|---|---|
| value | number | |
| reference | number | 
- Source:
Returns:
- Type
- number
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, lastInfo) → {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 | Description | 
|---|---|---|
| pes | shaka.extern.MPEG_PES | |
| lastInfo | {nalu: ?shaka.extern.VideoNalu, state: ?number} | 
- 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:
setDiscontinuitySequence(discontinuitySequence)
    Set the current discontinuity sequence number.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| discontinuitySequence | number | 
- Source:
Type Definitions
OpusMetadata
PMT.
Type:
- {channelCount: number, channelConfigCode: number, sampleRate: number}
Properties:
| Name | Type | Description | 
|---|---|---|
| channelCount | number | |
| channelConfigCode | number | |
| sampleRate | number | 
- Source:
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: