Class: shaka.text.MatroskaTextParser

Constructor

new MatroskaTextParser()

Implements:
Source:

Members

MIME_TYPE :string

The MIME type of the text streams that the Matroska parser creates. The container is what identifies the parser, the codec the format of the cues.
Type:
  • string
Source:

SSA_BLOCK_FIELDS_ :number

How many fields the text of a block of ASS has: ReadOrder, Layer, Style, Name, MarginL, MarginR, MarginV, Effect and Text.
Type:
  • number
Source:

Methods

formatSrtTime_(seconds) → {string}

Parameters:
Name Type Description
seconds number
Source:
Returns:
The time as HH:MM:SS,mmm.
Type
string

formatSsaTime_(seconds) → {string}

Parameters:
Name Type Description
seconds number
Source:
Returns:
The time as H:MM:SS.mmm, which is how ASS has them (with centiseconds, but the parser takes up to three digits).
Type
string

getEnd_(framesnon-null, index, time) → {number}

Gets when a cue ends. A cue that does not say how long it lasts ends where the next one starts or, for the last one, with the segment.
Parameters:
Name Type Description
frames Array<shaka.mkv.MatroskaClusterParser.Frame>
index number
time shaka.extern.TextParser.TimeContext
Source:
Returns:
Type
number

normalizeText_(text) → {string}

Makes the text of a cue safe to put in SRT, where an empty line ends the cue.
Parameters:
Name Type Description
text string
Source:
Returns:
Type
string

makeSrt_(framesnon-null, time) → {string}

Parameters:
Name Type Description
frames Array<shaka.mkv.MatroskaClusterParser.Frame>
time shaka.extern.TextParser.TimeContext
Source:
Returns:
Type
string

makeSsa_(framesnon-null, time) → {string}

Writes the events of the blocks after the header of the track, as a file of ASS has them. A block has the fields of a Dialogue line but for the times: ReadOrder, Layer (Marked in SSA), Style, Name, MarginL, MarginR, MarginV, Effect and Text.
Parameters:
Name Type Description
frames Array<shaka.mkv.MatroskaClusterParser.Frame>
time shaka.extern.TextParser.TimeContext
Source:
Returns:
Type
string

parseInit(datanon-null)

Parse an initialization segment. Some formats do not have init segments so this won't always be called.
Parameters:
Name Type Description
data Uint8Array The data that makes up the init segment.
Implements:
Source:

parseMedia(datanon-null, timeContext, urinullable, imagesnon-null) → {Array<!shaka.text.Cue>}

Parse a media segment and return the cues that make up the segment.
Parameters:
Name Type Attributes Description
data Uint8Array The next section of buffer.
timeContext shaka.extern.TextParser.TimeContext The time information that should be used to adjust the times values for each cue.
uri string | undefined <nullable>
The media uri.
images Array<string>
Implements:
Source:
Returns:
Type
Array<!shaka.text.Cue>

setManifestType(manifestType)

Notifies the manifest type.
Parameters:
Name Type Description
manifestType string
Implements:
Source: