Removed XHR for IE8

This commit is contained in:
Sam Potts 2015-02-17 23:17:15 +11:00
parent f8d71829e0
commit 97d6216409
2 changed files with 9 additions and 16 deletions

View File

@ -561,30 +561,23 @@
if (captionSrc !== "") { if (captionSrc !== "") {
// Create XMLHttpRequest Object // Create XMLHttpRequest Object
var xhr; var xhr = new XMLHttpRequest();
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
}
else if (window.ActiveXObject) { // IE8
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
xhr.onreadystatechange = function() { xhr.onreadystatechange = function() {
if (xhr.readyState === 4) { if (xhr.readyState === 4) {
if (xhr.status === 200) { if (xhr.status === 200) {
if (config.debug) {
console.log("xhr = 200");
}
player.captions = []; player.captions = [];
var records = [], var records = [],
record, record,
req = xhr.responseText; req = xhr.responseText;
records = req.split("\n\n"); records = req.split("\n\n");
for (var r=0; r < records.length; r++) { for (var r=0; r < records.length; r++) {
record = records[r]; record = records[r];
player.captions[r] = []; player.captions[r] = [];
player.captions[r] = record.split("\n"); player.captions[r] = record.split("\n");
} }
// Remove first element ("VTT") // Remove first element ("VTT")
player.captions.shift(); player.captions.shift();
@ -592,14 +585,14 @@
console.log("Successfully loaded the caption file via ajax."); console.log("Successfully loaded the caption file via ajax.");
} }
} }
else { else if (config.debug) {
if (config.debug) { console.error("There was a problem loading the caption file via ajax.");
console.log("There was a problem loading the caption file via ajax.");
}
} }
} }
} }
xhr.open("get", captionSrc, true); xhr.open("get", captionSrc, true);
xhr.send(); xhr.send();
} }
} }

2
dist/js/plyr.js vendored

File diff suppressed because one or more lines are too long