nl_tokens: Update captions using current track s active cues Also optional array argument in case there isn t any track ( ex : vimeo )
pl_tokens: function updateCues ( input ) { // Requires UI if ( ! this . supported . ui ) { return ; } if ( ! is$1 . element ( this . elements . captions ) ) { this . debug . warn ( 'No captions element to render to' ) ; return ; } // Only accept array or empty input if ( ! is$1 . nullOrUndefined ( input ) && ! Array . isArray ( input ) ) { this . debug . warn ( 'updateCues: Invalid input' , input ) ; return ; } var cues = input ; // Get cues from track if ( ! cues ) { var track = captions . getCurrentTrack . call ( this ) ; cues = Array . from ( ( track || { } ) . activeCues || [ ] ) . <mask> ( function ( cue ) { return cue . getCueAsHTML ( ) ; } ) . map ( getHTML ) ; } // Set new caption text var content = cues . map ( function ( cueText ) { return cueText . trim ( ) ; } ) . join ( '\n' ) ; var changed = content !== this . elements . captions . innerHTML ; if ( changed ) { // Empty the container and create a new child element emptyElement ( this . elements . captions ) ; var caption = createElement ( 'span' , getAttributesFromSelector ( this . config . selectors . caption ) ) ; caption . innerHTML = content ; this . elements . captions . appendChild ( caption ) ; // Trigger event triggerEvent . call ( this , this . media , 'cuechange' ) ; } }