Add code for re-checking if a user has gone live since loading the page
Also exempt static files from link rewriting in the SPA There may be more in here.. It's been a long break halfway through this commit.pull/18/head
parent
f703d5af7f
commit
8cb78a7dd6
|
@ -190,6 +190,8 @@ async function initPlayer(usr) {
|
||||||
shaka.polyfill.installAll();
|
shaka.polyfill.installAll();
|
||||||
shakaPolyFilled = true;
|
shakaPolyFilled = true;
|
||||||
}
|
}
|
||||||
|
var live = JSON.parse(await makeRequest("GET", "/api/"+usr+"/config")).live;
|
||||||
|
if(live){
|
||||||
// Create a Player instance.
|
// Create a Player instance.
|
||||||
const video = document.getElementById('video');
|
const video = document.getElementById('video');
|
||||||
const player = new shaka.Player(video);
|
const player = new shaka.Player(video);
|
||||||
|
@ -212,6 +214,9 @@ async function initPlayer(usr) {
|
||||||
// onError is executed if the asynchronous load fails.
|
// onError is executed if the asynchronous load fails.
|
||||||
onError(e);
|
onError(e);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
setTimeout(initPlayer, 5000, usr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onErrorEvent(event) {
|
function onErrorEvent(event) {
|
||||||
|
|
|
@ -5,10 +5,13 @@
|
||||||
shakaPolyFilled = false;
|
shakaPolyFilled = false;
|
||||||
var manifestUri = document.location.protocol+'//'+document.location.host+'/live/{{ username }}/index.mpd';
|
var manifestUri = document.location.protocol+'//'+document.location.host+'/live/{{ username }}/index.mpd';
|
||||||
async function initPlayer() {
|
async function initPlayer() {
|
||||||
|
console.log('Trying to initialize player.');
|
||||||
if(!shakaPolyFilled){
|
if(!shakaPolyFilled){
|
||||||
shaka.polyfill.installAll();
|
shaka.polyfill.installAll();
|
||||||
shakaPolyFilled = true;
|
shakaPolyFilled = true;
|
||||||
}
|
}
|
||||||
|
var live = JSON.parse(await makeRequest("GET", "/api/{{ username }}/config")).live;
|
||||||
|
if(live){
|
||||||
// Create a Player instance.
|
// Create a Player instance.
|
||||||
const video = document.getElementById('video');
|
const video = document.getElementById('video');
|
||||||
const player = new shaka.Player(video);
|
const player = new shaka.Player(video);
|
||||||
|
@ -31,6 +34,9 @@ async function initPlayer() {
|
||||||
// onError is executed if the asynchronous load fails.
|
// onError is executed if the asynchronous load fails.
|
||||||
onError(e);
|
onError(e);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
setTimeout(initPlayer, 5000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onErrorEvent(event) {
|
function onErrorEvent(event) {
|
||||||
|
|
Reference in New Issue