aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plyr.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r--src/js/plyr.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 04a68d02..200189b3 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -97,6 +97,7 @@ class Plyr {
this.options = {
speed: [],
quality: [],
+ captions: [],
};
// Debugging
@@ -875,17 +876,29 @@ class Plyr {
return;
}
- // Toggle captions based on input
- this.toggleCaptions(!utils.is.empty(input));
-
// If empty string is passed, assume disable captions
if (utils.is.empty(input)) {
+ this.toggleCaptions(false);
return;
}
// Normalize
const language = input.toLowerCase();
+ // Check for support
+ if (!this.options.captions.includes(language)) {
+ this.debug.warn(`Unsupported language option: ${language}`);
+ return;
+ }
+
+ // Ensure captions are enabled
+ this.toggleCaptions(true);
+
+ // Enabled only
+ if (language === 'enabled') {
+ return;
+ }
+
// If nothing to change, bail
if (this.language === language) {
return;