diff options
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/plyr.js | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js index 48ee8e63..36b99fd2 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -1089,18 +1089,15 @@ // Get URL of caption file if exists var captionSources = [], - captionSrc = '', - kind, - children = plyr.media.childNodes; - - for (var i = 0; i < children.length; i++) { - if (children[i].nodeName.toLowerCase() === 'track') { - kind = children[i].kind; - if (kind === 'captions' || kind === 'subtitles') { - captionSources.push(children[i].getAttribute('src')); + captionSrc = ''; + + plyr.media.childNodes.forEach(function(child) { + if (child.nodeName.toLowerCase() === 'track') { + if (child.kind === 'captions' || child.kind === 'subtitles') { + captionSources.push(child.getAttribute('src')); } } - } + }); // Record if caption file exists or not plyr.captionExists = true; @@ -1180,7 +1177,7 @@ caption, req = xhr.responseText; - //According to webvtt spec, line terminator consists of one of the following + // According to webvtt spec, line terminator consists of one of the following // CRLF (U+000D U+000A), LF (U+000A) or CR (U+000D) var lineSeparator = '\r\n'; if (req.indexOf(lineSeparator + lineSeparator) === -1) { |