mirror of
https://github.com/ReviveMii/revivetube
synced 2025-04-29 12:39:25 -04:00
loading fix
This commit is contained in:
parent
c0693ec17e
commit
60f083d6c2
1 changed files with 15 additions and 14 deletions
|
@ -102,22 +102,23 @@
|
||||||
setInterval(checkStatus, 1000);
|
setInterval(checkStatus, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function checkStatus() {
|
function checkStatus() {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open('GET', '/status/' + videoId, true);
|
xhr.open('GET', '/status/' + videoId, true);
|
||||||
xhr.onreadystatechange = function () {
|
xhr.onreadystatechange = function () {
|
||||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||||
var response;
|
var response;
|
||||||
try {
|
try {
|
||||||
response = JSON.parse(xhr.responseText);
|
response = eval('(' + xhr.responseText + ')');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
response = { status: 'error' };
|
response = { status: 'error' };
|
||||||
}
|
|
||||||
updateProgress(response);
|
|
||||||
}
|
}
|
||||||
};
|
updateProgress(response);
|
||||||
xhr.send();
|
}
|
||||||
}
|
};
|
||||||
|
xhr.send();
|
||||||
|
}
|
||||||
|
|
||||||
function updateProgress(status) {
|
function updateProgress(status) {
|
||||||
if (status.status === 'complete') {
|
if (status.status === 'complete') {
|
||||||
|
|
Loading…
Add table
Reference in a new issue