diff options
| author | Your Name <you@example.com> | 2019-02-27 15:45:24 +0100 | 
|---|---|---|
| committer | Your Name <you@example.com> | 2019-02-27 15:45:24 +0100 | 
| commit | ce91945544b51da0a3546367b5a41da3ccbd1eeb (patch) | |
| tree | e46f0379411b5be4a8e763d866ea42f0a9b66eb1 /src | |
| parent | 11fed8d1b5ec9bfcbeafa0a90ebbc0ac15711807 (diff) | |
| download | plyr-ce91945544b51da0a3546367b5a41da3ccbd1eeb.tar.lz plyr-ce91945544b51da0a3546367b5a41da3ccbd1eeb.tar.xz plyr-ce91945544b51da0a3546367b5a41da3ccbd1eeb.zip | |
Preview seek: optional hours and ms in VTT parser
Diffstat (limited to 'src')
| -rw-r--r-- | src/js/plugins/previewThumbnails.js | 6 | 
1 files changed, 3 insertions, 3 deletions
| diff --git a/src/js/plugins/previewThumbnails.js b/src/js/plugins/previewThumbnails.js index 90e6226d..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]}`); | 
