show big button regardless of chromecast being detected

This commit is contained in:
Roy Olav Purser 2021-05-21 14:11:31 +02:00
parent 45d9841743
commit 560928bc6e
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -61,11 +61,12 @@
smallCastButton.addClass("vjs-control"); smallCastButton.addClass("vjs-control");
smallCastButton.addClass("vjs-button"); smallCastButton.addClass("vjs-button");
let loadScreen = true; player.on("play", () => {
player.one("play", () => {
loadScreen = false;
player.removeChild(bigCastButton); player.removeChild(bigCastButton);
}); });
player.on("pause", () => {
player.addChild(bigCastButton);
});
player.on("chromecastConnected", () => { player.on("chromecastConnected", () => {
console.log(player.chromecastSessionManager.remotePlayer.volumeLevel); console.log(player.chromecastSessionManager.remotePlayer.volumeLevel);
@ -75,15 +76,9 @@
}); });
player.on("chromecastDevicesAvailable", () => { player.on("chromecastDevicesAvailable", () => {
player.controlBar.addChild(smallCastButton); player.controlBar.addChild(smallCastButton);
if(loadScreen) {
player.addChild(bigCastButton);
}
}); });
player.on("chromecastDevicesUnvailable", () => { player.on("chromecastDevicesUnvailable", () => {
player.controlBar.removeChild(smallCastButton); player.controlBar.removeChild(smallCastButton);
if(loadScreen) {
player.removeChild(bigCastButton);
}
}); });
} }
document.addEventListener("DOMContentLoaded", handleCount); document.addEventListener("DOMContentLoaded", handleCount);