Tweaks
This commit is contained in:
parent
613c45ede9
commit
90338d9600
@ -1064,18 +1064,15 @@
|
|||||||
|
|
||||||
// Get URL of caption file if exists
|
// Get URL of caption file if exists
|
||||||
var captionSources = [],
|
var captionSources = [],
|
||||||
captionSrc = '',
|
captionSrc = '';
|
||||||
kind,
|
|
||||||
children = plyr.media.childNodes;
|
|
||||||
|
|
||||||
for (var i = 0; i < children.length; i++) {
|
plyr.media.childNodes.forEach(function(child) {
|
||||||
if (children[i].nodeName.toLowerCase() === 'track') {
|
if (child.nodeName.toLowerCase() === 'track') {
|
||||||
kind = children[i].kind;
|
if (child.kind === 'captions' || child.kind === 'subtitles') {
|
||||||
if (kind === 'captions' || kind === 'subtitles') {
|
captionSources.push(child.getAttribute('src'));
|
||||||
captionSources.push(children[i].getAttribute('src'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// Record if caption file exists or not
|
// Record if caption file exists or not
|
||||||
plyr.captionExists = true;
|
plyr.captionExists = true;
|
||||||
@ -1152,18 +1149,18 @@
|
|||||||
caption,
|
caption,
|
||||||
req = xhr.responseText;
|
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)
|
// CRLF (U+000D U+000A), LF (U+000A) or CR (U+000D)
|
||||||
var lineSeparator = '\r\n';
|
var lineSeparator = '\r\n';
|
||||||
if(req.indexOf(lineSeparator+lineSeparator) === -1) {
|
if (req.indexOf(lineSeparator + lineSeparator) === -1) {
|
||||||
if(req.indexOf('\r\r') !== -1){
|
if (req.indexOf('\r\r') !== -1){
|
||||||
lineSeparator = '\r';
|
lineSeparator = '\r';
|
||||||
} else {
|
} else {
|
||||||
lineSeparator = '\n';
|
lineSeparator = '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
captions = req.split(lineSeparator+lineSeparator);
|
captions = req.split(lineSeparator + lineSeparator);
|
||||||
|
|
||||||
for (var r = 0; r < captions.length; r++) {
|
for (var r = 0; r < captions.length; r++) {
|
||||||
caption = captions[r];
|
caption = captions[r];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user