frontend: stream and fullscreen cleanup

This commit is contained in:
2025-08-09 14:22:34 -06:00
parent 9f9bb68e22
commit d4777fcf08
2 changed files with 81 additions and 80 deletions
+8 -2
View File
@@ -12,13 +12,19 @@
let loading = $state(true);
let fullscreen = $state(false);
let gameplayView: HTMLDivElement;
let gameplayCanvas: HTMLCanvasElement;
async function startStream() {
console.log(`Connecting to stream at ${url} with cert_hash ${certHash}`);
await streamUrl(url, certHash);
await streamUrl(url, certHash, gameplayCanvas);
}
async function requestFullscreen() {
// Update fullscreen var if fullscreen was exited outside our control
if (document.fullscreenElement == null) {
fullscreen = false;
}
if (fullscreen) {
await document.exitFullscreen();
fullscreen = false;
@@ -36,7 +42,7 @@
</script>
<div id="gameplay-view" class="gameplay-view" bind:this={gameplayView}>
<canvas id="gamestream-canvas" class="gamestream-canvas"></canvas>
<canvas id="gamestream-canvas" class="gamestream-canvas" bind:this={gameplayCanvas}></canvas>
<StreamUi fullscreenFunc={requestFullscreen}></StreamUi>
</div>