download cleanup
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Roy Olav Purser 2022-02-13 15:47:15 +01:00
parent 4267f6a7ca
commit b1a2a7cfc8
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -23,9 +23,6 @@
source.src = info.upstream;
player.src(source);
const dl = document.createElement("a");
dl.href = info.download;
const canPlayTypeRaw = player.canPlayType(info.ctype);
const canPlayType = (canPlayTypeRaw === "maybe") || (canPlayTypeRaw === "probably");
if(canPlayType) {
@ -37,13 +34,12 @@
cbutton.text = "Chromecast";
const dbutton = {};
dbutton.clickHandler = (ev) => {
document.body.appendChild(dl);
dl.click();
document.body.removeChild(dl);
}
dbutton.text = "Download";
dbutton.clickHandler = (ev) => {
if(info.download) {
window.open(info.download);
}
}
const bigCastButtonWrapper = new Button(player, cbutton);
const bigDownloadButtonWrapper = new Button(player, dbutton);
@ -83,7 +79,7 @@
player.one("play", () => {
player.removeChild(bigCastButtonWrapper);
if(!info.ctype.toLowerCase().includes("mpegurl")) {
if(info.download) {
player.removeChild(bigDownloadButtonWrapper);
}
});