nl_tokens: Update available language options in settings based on tracks
pl_tokens: function update ( ) { var _this = this ; var tracks = captions . getTracks . call ( this , true ) ; // Get the wanted language var _this$captions = this . captions , active = _this$captions . active , language = _this$captions . language , meta = _this$captions . meta , currentTrackNode = _this$captions . currentTrackNode ; var languageExists = Boolean ( tracks . find ( function ( track ) { return track . language === language ; } ) ) ; // Handle tracks (add event listener and "pseudo"-default) if ( this . isHTML5 && this . isVideo ) { tracks . filter ( function ( track ) { return ! meta . get ( track ) ; } ) . forEach ( function ( track ) { _this . debug . log ( 'Track added' , track ) ; // Attempt to store if the original dom element was "default" meta . set ( track , { default : track . mode === 'showing' } ) ; // Turn off native caption rendering to avoid double captions track . mode = 'hidden' ; // Add event listener for cue changes on . call ( _this , track , 'cuechange' , function ( ) { return captions . updateCues . call ( _this ) ; } ) ; } ) ; } // Update language first time it matches, or if the previous matching track was removed if ( languageExists && this . language !== language || ! tracks . includes ( currentTrackNode ) ) { captions . setLanguage . call ( this , language ) ; captions . toggle . <mask> ( this , active && languageExists ) ; } // Enable or disable captions based on track length toggleClass ( this . elements . container , this . config . classNames . captions . enabled , ! is$1 . empty ( tracks ) ) ; // Update available languages in list if ( ( this . config . controls || [ ] ) . includes ( 'settings' ) && this . config . settings . includes ( 'captions' ) ) { controls . setCaptionsMenu . call ( this ) ; } }