Browse Source

Use on Ready event instead of player setup hook

pull/5/head
Gabe Kangas 5 years ago
parent
commit
06ec265038
  1. 2
      webroot/js/app.js
  2. 7
      webroot/js/player/player.js

2
webroot/js/app.js

@ -10,7 +10,7 @@ async function setupApp() { @@ -10,7 +10,7 @@ async function setupApp() {
window.app = new Vue({
el: "#app-container",
data: {
streamStatus: "",
streamStatus: "Stream is offline.", // Default state.
viewerCount: 0,
sessionMaxViewerCount: 0,
overallMaxViewerCount: 0,

7
webroot/js/player/player.js

@ -4,12 +4,13 @@ window.VIDEOJS_NO_DYNAMIC_STYLE = true; @@ -4,12 +4,13 @@ window.VIDEOJS_NO_DYNAMIC_STYLE = true;
var waitingTimeoutTimer;
// Wait until the player is setup before we start polling status
videojs.hookOnce('setup', function (player) {
// console.log('setup')
const player = videojs('video');
player.on('ready', function () {
getStatus();
setInterval(getStatus, 5000);
setupPlayerEventHandlers();
});
})
function setupPlayerEventHandlers() {
const player = videojs('video');

Loading…
Cancel
Save