Add option to watch caption track changes and update language options
This commit is contained in:
		@ -83,6 +83,11 @@ const captions = {
 | 
			
		||||
        // Set toggled state
 | 
			
		||||
        this.toggleCaptions(active);
 | 
			
		||||
 | 
			
		||||
        // Watch changes to textTracks and update captions menu
 | 
			
		||||
        if (this.config.captions.update) {
 | 
			
		||||
            utils.on(this.media.textTracks, 'change', captions.update.bind(this));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Update available languages in list
 | 
			
		||||
        captions.update.call(this);
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
@ -116,6 +116,9 @@ const defaults = {
 | 
			
		||||
    captions: {
 | 
			
		||||
        active: false,
 | 
			
		||||
        language: (navigator.language || navigator.userLanguage).split('-')[0],
 | 
			
		||||
        // Listen to new tracks added after Plyr is initialized.
 | 
			
		||||
        // This is needed for streaming captions, but may result in unselectable options
 | 
			
		||||
        update: false,
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Fullscreen settings
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user