Fixed closed captioning bug

Fixed bug causing captions to show multiple unnecessary empty new lines
This commit is contained in:
amarcu5
2017-06-11 22:41:24 +01:00
parent b54770bd75
commit aaeb09f5e5
3 changed files with 10 additions and 3 deletions
Binary file not shown.
+9 -2
View File
@@ -159,9 +159,16 @@ const processCaptions = function() {
const walk = document.createTreeWalker(captionElement, NodeFilter.SHOW_TEXT, null, false);
while (walk.nextNode()) {
const segment = walk.currentNode.nodeValue.trim();
caption += segment ? segment + ' ' : '\n';
if (segment) {
caption += segment + ' ';
} else if (caption.charAt(caption.length - 1) != '\n') {
caption += '\n';
} else {
caption += '';
}
}
log('Showing caption "' + caption.trim() + '"');
caption = caption.trim();
log('Showing caption "' + caption + '"');
track.addCue(new VTTCue(video.currentTime, video.currentTime + 60, caption));
};
+1 -1
View File
@@ -10,7 +10,7 @@
<key>CFBundleShortVersionString</key>
<string>0.2.0</string>
<key>CFBundleVersion</key>
<string>38</string>
<string>39</string>
<key>Developer Identifier</key>
<string>BQ6Q24MF9X</string>
<key>URL</key>