aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plyr.js
diff options
context:
space:
mode:
authorSam Potts <me@sampotts.me>2015-08-08 21:01:06 +1000
committerSam Potts <me@sampotts.me>2015-08-08 21:01:06 +1000
commitf700d50dc8f1a45c9d010af3739047beff4f3859 (patch)
tree879763b0274e593f50641950e5f50fb5c5697f68 /src/js/plyr.js
parent7a23dda29435934139c15d6a2b136da2fbbdf533 (diff)
downloadplyr-f700d50dc8f1a45c9d010af3739047beff4f3859.tar.lz
plyr-f700d50dc8f1a45c9d010af3739047beff4f3859.tar.xz
plyr-f700d50dc8f1a45c9d010af3739047beff4f3859.zip
Fix for voiceover
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)