resize iframe if view width is smaller than frame

This commit is contained in:
vance 2024-05-02 21:32:17 -07:00
parent 1124bd9fb2
commit aaaf02ba1d

View File

@ -148,6 +148,14 @@
document.getElementById('live').remove();
}
const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
const vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
if (document.getElementById('live').width > vw) {
document.getElementById('live').width = vw;
document.getElementById('live').height = vw * (9 / 16);
}
// check if stream active every 5 seconds
setInterval(function checkLive() {
fetch(new URL('index.m3u8', socials.live.link))
@ -157,8 +165,6 @@
return checkLive;
}(), 5000);
const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
const vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
const min_speed = 10;
const max_speed = 20;
let entities = 0;