diff options
Diffstat (limited to 'src/js/captions.js')
-rw-r--r-- | src/js/captions.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/js/captions.js b/src/js/captions.js index 63674b95..fd2692f7 100644 --- a/src/js/captions.js +++ b/src/js/captions.js @@ -49,10 +49,7 @@ const captions = { const src = track.getAttribute('src'); const url = parseUrl(src); - if (url !== null && url.hostname !== window.location.href.hostname && [ - 'http:', - 'https:', - ].includes(url.protocol)) { + if (url !== null && url.hostname !== window.location.href.hostname && ['http:', 'https:'].includes(url.protocol)) { fetch(src, 'blob') .then(blob => { track.setAttribute('src', window.URL.createObjectURL(blob)); @@ -277,10 +274,9 @@ const captions = { const tracks = Array.from((this.media || {}).textTracks || []); // For HTML5, use cache instead of current tracks when it exists (if captions.update is false) // Filter out removed tracks and tracks that aren't captions/subtitles (for example metadata) - return tracks.filter(track => !this.isHTML5 || update || this.captions.meta.has(track)).filter(track => [ - 'captions', - 'subtitles', - ].includes(track.kind)); + return tracks + .filter(track => !this.isHTML5 || update || this.captions.meta.has(track)) + .filter(track => ['captions', 'subtitles'].includes(track.kind)); }, // Match tracks based on languages and get the first |