merge frontend-improvments #18
|
@ -167,7 +167,7 @@ function handleLoad() {
|
|||
|
||||
function modifyLinks() {
|
||||
for (var ls = document.links, numLinks = ls.length, i=0; i<numLinks; i++){
|
||||
if(ls[i].href.indexOf(location.protocol+'//'+location.host) !== -1) {
|
||||
if(ls[i].href.indexOf(location.protocol+'//'+location.host) !== -1 && ls[i].href.match(new RegExp(/\/\w+\.\w+$/)) === null) {
|
||||
//should be a regular link
|
||||
ls[i].setAttribute('onclick', 'return internalLink(\"'+ls[i].href.substring((location.protocol+'//'+location.host).length)+'\")');
|
||||
}
|
||||
|
@ -190,6 +190,8 @@ async function initPlayer(usr) {
|
|||
shaka.polyfill.installAll();
|
||||
shakaPolyFilled = true;
|
||||
}
|
||||
var live = JSON.parse(await makeRequest("GET", "/api/"+usr+"/config")).live;
|
||||
if(live){
|
||||
// Create a Player instance.
|
||||
const video = document.getElementById('video');
|
||||
const player = new shaka.Player(video);
|
||||
|
@ -212,6 +214,9 @@ async function initPlayer(usr) {
|
|||
// onError is executed if the asynchronous load fails.
|
||||
onError(e);
|
||||
}
|
||||
} else {
|
||||
setTimeout(initPlayer, 5000, usr);
|
||||
}
|
||||
}
|
||||
|
||||
function onErrorEvent(event) {
|
||||
|
|
|
@ -5,10 +5,13 @@
|
|||
shakaPolyFilled = false;
|
||||
var manifestUri = document.location.protocol+'//'+document.location.host+'/live/{{ username }}/index.mpd';
|
||||
async function initPlayer() {
|
||||
console.log('Trying to initialize player.');
|
||||
if(!shakaPolyFilled){
|
||||
shaka.polyfill.installAll();
|
||||
shakaPolyFilled = true;
|
||||
}
|
||||
var live = JSON.parse(await makeRequest("GET", "/api/{{ username }}/config")).live;
|
||||
if(live){
|
||||
// Create a Player instance.
|
||||
const video = document.getElementById('video');
|
||||
const player = new shaka.Player(video);
|
||||
|
@ -31,6 +34,9 @@ async function initPlayer() {
|
|||
// onError is executed if the asynchronous load fails.
|
||||
onError(e);
|
||||
}
|
||||
} else {
|
||||
setTimeout(initPlayer, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
function onErrorEvent(event) {
|
||||
|
|
Reference in New Issue