hls.js tweaks

This commit is contained in:
vance 2024-05-07 21:06:17 -07:00
parent 2ac4bb6dfc
commit 2c5818e315

View File

@ -79,7 +79,7 @@
<body>
<img alt='banana' id='banana' src='banana.png'/>
<img alt='bonzi' id='bonzi' src='bonzi.png'/>
<video autoplay height='360px' playsinline id='live' width='640px'>
<video autoplay controls height='360px' playsinline id='live' width='640px'>
</video>
<script src="https://cdn.jsdelivr.net/npm/hls.js/dist/hls.min.js"></script>
<script>
@ -177,7 +177,7 @@
const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
const vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
// resize iframe if view width is smaller than frame
// resize video if view width is smaller than frame
if (parseInt(live.width, 10) > vw) {
live.width = `${vw}px`;
live.height = `${vw * (9 / 16)}px`;
@ -206,7 +206,7 @@
hls.loadSource(liveSrc);
});
hls.on(Hls.Events.MANIFEST_PARSED, () => {
live.style.display = 'inline';
live.style.removeProperty('display');
live.play();
});