aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plugins/previewThumbnails.js
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2019-04-12 18:39:14 +1000
committerGitHub <noreply@github.com>2019-04-12 18:39:14 +1000
commit5fefabe3bddf705f3c3956152882b5ceab44c8dc (patch)
tree43c1b11c4361e02189ae643f525efb155d8a99d0 /src/js/plugins/previewThumbnails.js
parent0f3098040d8650a762067d1f1aa5ab520cb9b90c (diff)
parente281078441ad50c4b0b997b615b48fc0c254f173 (diff)
downloadplyr-5fefabe3bddf705f3c3956152882b5ceab44c8dc.tar.lz
plyr-5fefabe3bddf705f3c3956152882b5ceab44c8dc.tar.xz
plyr-5fefabe3bddf705f3c3956152882b5ceab44c8dc.zip
Merge pull request #1410 from sampotts/develop
v3.5.3
Diffstat (limited to 'src/js/plugins/previewThumbnails.js')
-rw-r--r--src/js/plugins/previewThumbnails.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/js/plugins/previewThumbnails.js b/src/js/plugins/previewThumbnails.js
index bd7a6bbd..813bc47e 100644
--- a/src/js/plugins/previewThumbnails.js
+++ b/src/js/plugins/previewThumbnails.js
@@ -17,17 +17,17 @@ const parseVtt = vttDataString => {
if (!is.number(result.startTime)) {
// The line with start and end times on it is the first line of interest
const matchTimes = line.match(
- /([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{2,3})/,
+ /([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/,
); // Note that this currently ignores caption formatting directives that are optionally on the end of this line - fine for non-captions VTT
if (matchTimes) {
result.startTime =
- Number(matchTimes[1]) * 60 * 60 +
+ Number(matchTimes[1] || 0) * 60 * 60 +
Number(matchTimes[2]) * 60 +
Number(matchTimes[3]) +
Number(`0.${matchTimes[4]}`);
result.endTime =
- Number(matchTimes[6]) * 60 * 60 +
+ Number(matchTimes[6] || 0) * 60 * 60 +
Number(matchTimes[7]) * 60 +
Number(matchTimes[8]) +
Number(`0.${matchTimes[9]}`);
@@ -148,7 +148,10 @@ class PreviewThumbnails {
// If the URLs don't start with '/', then we need to set their relative path to be the location of the VTT file
// If the URLs do start with '/', then they obviously don't need a prefix, so it will remain blank
- if (!thumbnail.frames[0].text.startsWith('/')) {
+ // If the thumbnail URLs start with with none of '/', 'http://' or 'https://', then we need to set their relative path to be the location of the VTT file
+ if (!thumbnail.frames[0].text.startsWith('/') &&
+ !thumbnail.frames[0].text.startsWith('http://') &&
+ !thumbnail.frames[0].text.startsWith('https://')) {
thumbnail.urlPrefix = url.substring(0, url.lastIndexOf('/') + 1);
}