Class: shaka.util.TsParser

Members

H264_NALU_TYPE_SPS_ :number

NALU type for Sequence Parameter Set (SPS) for H.264.
Type:
  • number
Source:

PacketLength_ :number

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:

Timescale :number

Type:
  • number
Source:

audioCodec_ :string

Type:
  • string
Source:

audioData_ :Array.<Uint8Array>

Type:
  • Array.<Uint8Array>
Source:

audioPid_ :number

Type:
  • number
Source:

audioStartTime_ :number

Type:
  • number
Source:

id3Data_ :Array.<Uint8Array>

Type:
  • Array.<Uint8Array>
Source:

id3Pid_ :number

Type:
  • number
Source:

pmtId_ :number

Type:
  • number
Source:

pmtParsed_ :boolean

Type:
  • boolean
Source:

videoCodec_ :string

Type:
  • string
Source:

videoData_ :Array.<Uint8Array>

Type:
  • Array.<Uint8Array>
Source:

videoPid_ :number

Type:
  • number
Source:

videoStartTime_ :number

Type:
  • 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

clearData()

Clear previous data
Source:

getAudioData() → {Array.<shaka.extern.MPEG_PES>}

Return the audio data
Source:
Returns:
Type
Array.<shaka.extern.MPEG_PES>

getCodecs() → {{audio: ?string, video: ?string}}

Return the audio and video codecs
Source:
Returns:
Type
{audio: ?string, video: ?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>

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>

parsePES_(data, isVideoopt) → {shaka.extern.MPEG_PES}

Parse PES
Parameters:
Name Type Attributes Default Description
data Uint8Array
isVideo boolean <optional>
false
Source:
Returns:
Type
shaka.extern.MPEG_PES

parsePMT_(data, offset) → {shaka.util.TsParser.PMT}

Parse PMT
Parameters:
Name Type Description
data Uint8Array
offset number
Source:
Returns:
Type
shaka.util.TsParser.PMT

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: