Constructor
    
    
    new VttTextParser()
    
    
    
    
    
    
    
    
    - Implements:
 
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
 
    
     
    
    
    
    
    
    
    
        Members
        
            
MPEG_TIMESCALE_ :number
    Type:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
 
        
            
TS_ROLLOVER_ :number
    At this value, timestamps roll over in TS content.
    Type:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
 
        
    
    
        Methods
        
            
    
    
    addDefaultTextColor_(stylesnon-null)
    
    
    Add default color
    Parameters:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
 
        
            
    
    
    generateCueFromElement_(elementnon-null, rootCuenon-null, cues, stylesnon-null)
    
    
    Parameters:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
 
        
            
    
    
    getOrDefault_(value, defaultValue)
    
    
    Parameters:
    
    
    
        
        | Name | 
        
        Type | 
        
        
        Description | 
    
    
    
    
        
            
                value | 
            
            
            
                
string
            
             | 
            
            
             | 
        
    
        
            
                defaultValue | 
            
            
            
                
string
            
             | 
            
            
             | 
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
 
        
            
        
            
    
    
    htmlUnescape_(inputnon-null) → {string}
    
    
    This method converts the HTML entities &, <, >, ", ',
 ,  and  in string to their corresponding characters.
    Parameters:
    
    
    
        
        | Name | 
        
        Type | 
        
        
        Description | 
    
    
    
    
        
            
                input | 
            
            
            
                
string
            
             | 
            
            
             | 
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
Returns:
        
    - 
        Type
    
 
    - 
        
string
    
 
    
 
        
            
    
    
    mergeStyle_(cuenon-null, refCue)
    
    
    Merges values created in parseStyle_
    Parameters:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
 
        
            
    
    
    parseCue_(textnon-null, timeOffset, regionsnon-null, stylesnon-null) → {shaka.text.Cue}
    
    
    Parses a text block into a Cue object.
    Parameters:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
Returns:
        
    - 
        Type
    
 
    - 
        
shaka.text.Cue
    
 
    
 
        
            
    
    
    parseCueSetting(cuenon-null, word, regionsnon-null) → {boolean}
    
    
    Parses a WebVTT setting from the given word.
    Parameters:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
Returns:
        
    True on success.
    - 
        Type
    
 
    - 
        
boolean
    
 
    
 
        
            
    
    
    parseCueStyles(payload, rootCuenon-null, stylesnon-null)
    
    
    Parses a WebVTT styles from the given payload.
    Parameters:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
 
        
            
    
    
    parsedLineValueAndInterpretation_(cuenon-null, word) → {boolean}
    
    
    Parameters:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
Returns:
        
    - 
        Type
    
 
    - 
        
boolean
    
 
    
 
        
            
    
    
    
    
    
    Parses a string into a Region object.
    Parameters:
    
    
    
        
        | Name | 
        
        Type | 
        
        
        Description | 
    
    
    
    
        
            
                text | 
            
            
            
                
string
            
             | 
            
            
             | 
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
Returns:
        
    - 
        Type
    
 
    - 
        
shaka.extern.CueRegion
    
 
    
 
        
            
    
    
    parseRegionSetting_(regionnon-null, word) → {boolean}
    
    
    Parses a WebVTTRegion setting from the given word.
    Parameters:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
Returns:
        
    True on success.
    - 
        Type
    
 
    - 
        
boolean
    
 
    
 
        
            
    
    
    parseStyle_(textnon-null, stylesnon-null)
    
    
    Parses a style block into a Cue object.
    Parameters:
    
    
    
        
        | Name | 
        
        Type | 
        
        
        Description | 
    
    
    
    
        
            
                text | 
            
            
            
                
Array.<string>
            
             | 
            
            
             | 
        
    
        
            
                styles | 
            
            
            
                
Map.<string, shaka.text.Cue>
            
             | 
            
            
             | 
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
 
        
            
    
    
    parseTime_(parsernon-null) → {number}
    
    
    Parses a WebVTT time from the given parser.
    Parameters:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
Returns:
        
    - 
        Type
    
 
    - 
        
number
    
 
    
 
        
            
    
    
    replaceColorPayload_(payload) → {string}
    
    
    Converts color end tag to be valid for xml parsing
For example,
input: Yellow text on blue bg
output: Yellow text on blue bg
Returns original payload if invalid tag is found.
Invalid tag example: Example
    Parameters:
    
    
    
        
        | Name | 
        
        Type | 
        
        
        Description | 
    
    
    
    
        
            
                payload | 
            
            
            
                
string
            
             | 
            
            
             | 
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
Returns:
        
    processed payload
    - 
        Type
    
 
    - 
        
string
    
 
    
 
        
            
    
    
    replaceVoiceStylePayload_(payload) → {string}
    
    
    Converts voice style tag to be valid for xml parsing
For example,
input: Test
output: Test
    Parameters:
    
    
    
        
        | Name | 
        
        Type | 
        
        
        Description | 
    
    
    
    
        
            
                payload | 
            
            
            
                
string
            
             | 
            
            
             | 
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
Returns:
        
    processed payload
    - 
        Type
    
 
    - 
        
string
    
 
    
 
        
            
    
    
    setPositionAlign_(cuenon-null, align)
    
    
    Parameters:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
 
        
            
    
    
    setTextAlign_(cuenon-null, align)
    
    
    Parameters:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
 
        
            
    
    
    setVerticalWritingMode_(cuenon-null, value)
    
    
    Parameters:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
 
        
            
    
    
    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:
 
    
    
    
    
    
 
        
            
    
    
    
    
    
    Parse a media segment and return the cues that make up the segment.
    Parameters:
    
    
    
        
        | Name | 
        
        Type | 
        
        
        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. | 
        
    
    
    
    
    
    
    
    
    - Implements:
 
    
    
    
    
    
    
    
    
    
    
    - Source:
 
    
    
    
    
    
Returns:
        
    - 
        Type
    
 
    - 
        
Array.<!shaka.extern.Cue>