simplify cast

This commit is contained in:
Roy Olav Purser 2021-05-21 20:29:29 +02:00
parent 99ba95bd25
commit bf627362b1
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -56,31 +56,20 @@
bigCastButton.addClass("vjs-big-chromecast");
player.addChild(bigCastButton);
player.on("play", () => {
bigCastButton.hide();
});
player.on("pause", () => {
bigCastButton.show();
});
const smallCastButton = new Button(player, cbutton);
smallCastButton.addClass("fab");
smallCastButton.addClass("fa-chromecast");
smallCastButton.addClass("vjs-control");
smallCastButton.addClass("vjs-button");
player.controlBar.addChild(smallCastButton);
player.on("play", () => {
player.controlBar.removeChild(bigCastButton);
});
player.on("chromecastConnected", () => {
console.log(player.chromecastSessionManager.remotePlayer.volumeLevel);
if(player.volume() > 0.3) {
player.volume(0.2);
}
});
player.on("chromecastDevicesAvailable", () => {
player.controlBar.addChild(smallCastButton);
});
player.on("chromecastDevicesUnvailable", () => {
player.controlBar.removeChild(smallCastButton);
});
}
document.addEventListener("DOMContentLoaded", handleCount);
xhr.addEventListener("load", handleCount);