aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/captions.js
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2018-06-15 15:34:29 +1000
committerGitHub <noreply@github.com>2018-06-15 15:34:29 +1000
commitd522e405942e060180c7f5b28c914028e94a917b (patch)
tree71986987e1c10eca00d6796551b2f065f9d07d03 /src/js/captions.js
parent3cd2b9a6c3ab2a7b530f1f0e6eae884ba41b9211 (diff)
parent6bff6b317d6adcd9f94c8d4d8ee225d39f784e0f (diff)
downloadplyr-d522e405942e060180c7f5b28c914028e94a917b.tar.lz
plyr-d522e405942e060180c7f5b28c914028e94a917b.tar.xz
plyr-d522e405942e060180c7f5b28c914028e94a917b.zip
Merge pull request #1034 from friday/remove-array-newline-rule
Suggestion: Remove array newline rule
Diffstat (limited to 'src/js/captions.js')
-rw-r--r--src/js/captions.js12
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