|
|
|
@ -5,7 +5,6 @@ |
|
|
|
|
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; |
|
|
|
@ -58,9 +57,22 @@ function newPopup(url) { |
|
|
|
|
popupWindow = window.open( |
|
|
|
|
url,'popUpWindow','height=700,width=450,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes') |
|
|
|
|
} |
|
|
|
|
async function updateViewers(){ |
|
|
|
|
let vc = document.getElementById('viewercount'); |
|
|
|
|
if(!vc) return false; |
|
|
|
|
let path = window.location.pathname; |
|
|
|
|
if(path.substring(path.length - 1).indexOf('/') !== -1) |
|
|
|
|
var usr = path.substring(7, path.length - 1); |
|
|
|
|
else var usr = path.substring(7); |
|
|
|
|
let viewers = JSON.parse(await makeRequest("GET", "/api/"+usr+"/config")).viewers; |
|
|
|
|
vc.innerHTML = "[Viewers: "+viewers+"]"; |
|
|
|
|
setTimeout(updateViewers, 2000); |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
</br> |
|
|
|
|
<span style="float: left;font-size: large;"><a href="/live/{{ username }}/index.mpd">{{ username }}</a> | {{ title | escape }}</b></span><span style="float: right;font-size: large;"> Links | <a href="rtmp://{{ domain }}/live/{{ username }}">Watch</a> <a href="JavaScript:newPopup('/chat?room={{ username }}');">Chat</a> <a href="/vods/{{ username }}">VODs</a></span> |
|
|
|
|
<span style="float: left;font-size: large;"><a href="/live/{{ username }}/index.mpd">{{ username }}</a> | {{ title | escape }}<span id="viewercount" onload="updateViewers">[Viewers: {{viewers}}]</span> |
|
|
|
|
<script>updateViewers()</script> |
|
|
|
|
</b></span><span style="float: right;font-size: large;"> Links | <a href="rtmp://{{ domain }}/live/{{ username }}">Watch</a> <a href="JavaScript:newPopup('/chat?room={{ username }}');">Chat</a> <a href="/vods/{{ username }}">VODs</a></span> |
|
|
|
|
<div id="jscontainer"> |
|
|
|
|
<div id="jschild" style="width: 70%;height: 100%;position: relative;"> |
|
|
|
|
<image id="playbtn" src="/play.svg" alt="Play Stream" style="width:100%;height:100%;width: 950px;height: 534px;position: absolute;" onclick="document.getElementById('video').paused ? document.getElementById('video').play() : document.getElementById('video') .pause();"></image> |
|
|
|
|