loadLocaleInVideoJS.cache[path] = json
return json
})
+ .catch(err => {
+ console.error('Cannot get player translations', err)
+ return undefined
+ })
}
const completeLocale = getCompleteLocale(locale)
return fetch(path + '/server.json')
.then(res => res.json())
+ .catch(err => {
+ console.error('Cannot get server translations', err)
+ return undefined
+ })
}
// ############################################################################
this.player.src = this.savePlayerSrcFunction
this.player.src(httpUrl)
+ // We changed the source, so reinit captions
+ this.initCaptions()
+
return this.tryToPlay(err => {
if (err && done) return done(err)
default: this.defaultSubtitle === caption.language
}, false)
}
+
+ this.player.trigger('captionsChanged')
}
// Thanks: https://github.com/videojs/video.js/issues/4460#issuecomment-312861657
// Update on rate change
player.on('ratechange', this.submenuClickHandler)
+ if (subMenuName === 'CaptionsButton') {
+ // Hack to regenerate captions on HTTP fallback
+ player.on('captionsChanged', () => {
+ setTimeout(() => {
+ this.settingsSubMenuEl_.innerHTML = ''
+ this.settingsSubMenuEl_.appendChild(this.subMenu.menu.el_)
+ this.update()
+ this.bindClickEvents()
+
+ }, 0)
+ })
+ }
+
this.reset()
}, 0)
})