From 983612f460ccabfd1bbfecf967bfbdc6ff4883fd Mon Sep 17 00:00:00 2001 From: dmynerd78 Date: Sat, 26 Aug 2023 07:15:36 -0700 Subject: [PATCH] Add fullscreen hotkey to video player (#524) * Add fullscreen hotkey * Run prettier formatting --- tubearchivist/static/script.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tubearchivist/static/script.js b/tubearchivist/static/script.js index 7d2d3cf8..990e76c9 100644 --- a/tubearchivist/static/script.js +++ b/tubearchivist/static/script.js @@ -1483,6 +1483,21 @@ function doShortcut(e) { player.muted = !player.muted; break; } + case 'f': { + e.preventDefault(); + if (document.fullscreenElement === null) { + player.requestFullscreen().catch(e => { + console.error(e); + showModal('Unable to enter fullscreen', 3000); + }); + } else { + document.exitFullscreen().catch(e => { + console.error(e); + showModal('Unable to exit fullscreen', 3000); + }); + } + break; + } case 'ArrowLeft': { e.preventDefault(); showModal('- 5 seconds', 500); @@ -1527,6 +1542,7 @@ function doShortcut(e) { +
Show help?
Toggle mutem
Toggle fullscreenf
Toggle subtitles (if available)c
Increase speed>
Decrease speed<