From 435656a4cc97f23d3c03366847dd011ef49ceeb4 Mon Sep 17 00:00:00 2001 From: mkelvers Date: Tue, 21 Apr 2026 01:21:56 +0200 Subject: [PATCH] fix: guard fullscreen on ios and space key in player --- static/player.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/static/player.ts b/static/player.ts index 774076b..78a697e 100644 --- a/static/player.ts +++ b/static/player.ts @@ -645,11 +645,13 @@ const initPlayer = (): void => { const toggleFullscreen = (): void => { if (document.fullscreenElement) { - document.exitFullscreen() + if (document.exitFullscreen) document.exitFullscreen() return } - container.requestFullscreen() + if ('requestFullscreen' in container && typeof container.requestFullscreen === 'function') { + container.requestFullscreen() + } } // Initialize @@ -804,7 +806,10 @@ const initPlayer = (): void => { }).then(async (res) => { if (!res.ok) return const html = await res.text() - watchStatusDropdown.outerHTML = `${html}` + const wrapper = document.createElement('span') + wrapper.id = 'watch-status-dropdown' + wrapper.innerHTML = html + watchStatusDropdown.replaceWith(wrapper) }).catch(() => {}) } } catch { @@ -955,6 +960,8 @@ const initPlayer = (): void => { container.addEventListener('mousemove', showControls) document.addEventListener('keydown', (event) => { + const target = event.target as HTMLElement + if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable) return if (event.code === 'Space') { event.preventDefault() togglePlayPause()