Add fullscreen hotkey to video player (#524)

* Add fullscreen hotkey

* Run prettier formatting
This commit is contained in:
dmynerd78 2023-08-26 07:15:36 -07:00 committed by GitHub
parent d42bd612d0
commit 983612f460
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {
<table style="margin: auto; background: rgba(0,0,0,.5)"><tbody>
<tr><td>Show help</td><td>?</td>
<tr><td>Toggle mute</td><td>m</td>
<tr><td>Toggle fullscreen</td><td>f</td>
<tr><td>Toggle subtitles (if available)</td><td>c</td>
<tr><td>Increase speed</td><td>&gt;</td>
<tr><td>Decrease speed</td><td>&lt;</td>