diff --git a/frontend/script.js b/frontend/script.js index 4556e87..448901a 100644 --- a/frontend/script.js +++ b/frontend/script.js @@ -61,11 +61,12 @@ smallCastButton.addClass("vjs-control"); smallCastButton.addClass("vjs-button"); - let loadScreen = true; - player.one("play", () => { - loadScreen = false; + player.on("play", () => { player.removeChild(bigCastButton); }); + player.on("pause", () => { + player.addChild(bigCastButton); + }); player.on("chromecastConnected", () => { console.log(player.chromecastSessionManager.remotePlayer.volumeLevel); @@ -75,15 +76,9 @@ }); player.on("chromecastDevicesAvailable", () => { player.controlBar.addChild(smallCastButton); - if(loadScreen) { - player.addChild(bigCastButton); - } }); player.on("chromecastDevicesUnvailable", () => { player.controlBar.removeChild(smallCastButton); - if(loadScreen) { - player.removeChild(bigCastButton); - } }); } document.addEventListener("DOMContentLoaded", handleCount);