This commit is contained in:
parent
4267f6a7ca
commit
b1a2a7cfc8
@ -23,9 +23,6 @@
|
|||||||
source.src = info.upstream;
|
source.src = info.upstream;
|
||||||
player.src(source);
|
player.src(source);
|
||||||
|
|
||||||
const dl = document.createElement("a");
|
|
||||||
dl.href = info.download;
|
|
||||||
|
|
||||||
const canPlayTypeRaw = player.canPlayType(info.ctype);
|
const canPlayTypeRaw = player.canPlayType(info.ctype);
|
||||||
const canPlayType = (canPlayTypeRaw === "maybe") || (canPlayTypeRaw === "probably");
|
const canPlayType = (canPlayTypeRaw === "maybe") || (canPlayTypeRaw === "probably");
|
||||||
if(canPlayType) {
|
if(canPlayType) {
|
||||||
@ -37,13 +34,12 @@
|
|||||||
cbutton.text = "Chromecast";
|
cbutton.text = "Chromecast";
|
||||||
|
|
||||||
const dbutton = {};
|
const dbutton = {};
|
||||||
dbutton.clickHandler = (ev) => {
|
|
||||||
document.body.appendChild(dl);
|
|
||||||
dl.click();
|
|
||||||
document.body.removeChild(dl);
|
|
||||||
}
|
|
||||||
|
|
||||||
dbutton.text = "Download";
|
dbutton.text = "Download";
|
||||||
|
dbutton.clickHandler = (ev) => {
|
||||||
|
if(info.download) {
|
||||||
|
window.open(info.download);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const bigCastButtonWrapper = new Button(player, cbutton);
|
const bigCastButtonWrapper = new Button(player, cbutton);
|
||||||
const bigDownloadButtonWrapper = new Button(player, dbutton);
|
const bigDownloadButtonWrapper = new Button(player, dbutton);
|
||||||
@ -83,7 +79,7 @@
|
|||||||
|
|
||||||
player.one("play", () => {
|
player.one("play", () => {
|
||||||
player.removeChild(bigCastButtonWrapper);
|
player.removeChild(bigCastButtonWrapper);
|
||||||
if(!info.ctype.toLowerCase().includes("mpegurl")) {
|
if(info.download) {
|
||||||
player.removeChild(bigDownloadButtonWrapper);
|
player.removeChild(bigDownloadButtonWrapper);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user