aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbin Larsson <mail@albinlarsson.com>2018-06-16 01:07:16 +0200
committerAlbin Larsson <mail@albinlarsson.com>2018-06-16 01:07:16 +0200
commit1f09493ba2253eb234803b5ebe74ad1649253bb9 (patch)
treea8aaca1f0ad0ea4c7abed25cd5083834c400581b
parentd522e405942e060180c7f5b28c914028e94a917b (diff)
downloadplyr-1f09493ba2253eb234803b5ebe74ad1649253bb9.tar.lz
plyr-1f09493ba2253eb234803b5ebe74ad1649253bb9.tar.xz
plyr-1f09493ba2253eb234803b5ebe74ad1649253bb9.zip
Captions: Handle uppercase input (like before)
-rw-r--r--src/js/captions.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/js/captions.js b/src/js/captions.js
index fd2692f7..d6666cf2 100644
--- a/src/js/captions.js
+++ b/src/js/captions.js
@@ -71,7 +71,7 @@ const captions = {
const languages = dedupe(Array.from(navigator.languages || navigator.userLanguage)
.map(language => language.split('-')[0]));
- let language = this.storage.get('language') || this.config.captions.language;
+ let language = (this.storage.get('language') || this.config.captions.language || 'auto').toLowerCase();
// Use first browser language when language is 'auto'
if (language === 'auto') {
@@ -252,13 +252,14 @@ const captions = {
// Set captions by language
// Used internally for the language setter with the passive option forced to false
- setLanguage(language, passive = true) {
- if (!is.string(language)) {
- this.debug.warn('Invalid language argument', language);
+ setLanguage(input, passive = true) {
+ if (!is.string(input)) {
+ this.debug.warn('Invalid language argument', input);
return;
}
// Normalize
- this.captions.language = language.toLowerCase();
+ const language = input.toLowerCase();
+ this.captions.language = language;
// Set currentTrack
const tracks = captions.getTracks.call(this);