Add 'passive' flag to internal captions methods to avoid overriding user preferences, support multiple browser languages (get first match) and improve comments

This commit is contained in:
Albin Larsson
2018-06-15 06:06:16 +02:00
parent cf5f77c709
commit 19e412a73a
2 changed files with 104 additions and 57 deletions

4
src/js/controls.js vendored
View File

@ -848,7 +848,7 @@ const controls = {
// Generate options data
const options = tracks.map((track, value) => ({
value,
checked: this.captions.active && this.currentTrack === value,
checked: this.captions.toggled && this.currentTrack === value,
title: captions.getLabel.call(this, track),
badge: track.language && controls.createBadge.call(this, track.language.toUpperCase()),
list,
@ -858,7 +858,7 @@ const controls = {
// Add the "Disabled" option to turn off captions
options.unshift({
value: -1,
checked: !this.captions.active,
checked: !this.captions.toggled,
title: i18n.get('disabled', this.config),
list,
type: 'language',