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.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js
index a1db3e3e..cf846f18 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -640,20 +640,27 @@
}
}
- // Clear the caption
- player.captionsContainer.innerHTML = "";
-
// Check if the next caption is in the current time range
if (player.media.currentTime.toFixed(1) >= _timecodeMin(player.captions[player.subcount][0]) &&
player.media.currentTime.toFixed(1) <= _timecodeMax(player.captions[player.subcount][0])) {
player.currentCaption = player.captions[player.subcount][1];
- // Render the caption (only if changed)
+ // Trim caption text
var content = player.currentCaption.trim();
+
+ // Render the caption (only if changed)
if(player.captionsContainer.innerHTML != content) {
+ // Empty caption
+ // Otherwise NVDA reads it twice
+ player.captionsContainer.innerHTML = "";
+
+ // Set new caption text
player.captionsContainer.innerHTML = content;
}
}
+ else {
+ player.captionsContainer.innerHTML = "";
+ }
}
// Display captions container and button (for initialization)