This commit is contained in:
Korbs 2023-11-06 03:05:04 -05:00
parent b43926ae08
commit 55733c5dd8
No known key found for this signature in database
3 changed files with 34 additions and 14 deletions

View file

@ -141,31 +141,51 @@ function Util() {
Button_Volume.addEventListener('click', Toggle_Mute) Button_Volume.addEventListener('click', Toggle_Mute)
// Keyboard Shortcuts // Keyboard Shortcuts
/// Grab custom ones, if any
if (video.getAttribute('keyboard-shortcut-fullscreen'))
{var Fullscreen_KeyboardShortcut = video.getAttribute('keyboard-shortcut-fullscreen')
} else {var Fullscreen_KeyboardShortcut = 'f'}
if (video.getAttribute('keyboard-shortcut-mute'))
{var Mute_KeyboardShortcut = video.getAttribute('keyboard-shortcut-mute')
} else {var Mute_KeyboardShortcut = 'm'}
if (video.getAttribute('keyboard-shortcut-playpause'))
{var PlayPause_KeyboardShortcut = video.getAttribute('keyboard-shortcut-playpause')
} else {var PlayPause_KeyboardShortcut = 'k'}
if (video.getAttribute('keyboard-shortcut-skipback'))
{var SkipBack_KeyboardShortcut = video.getAttribute('keyboard-shortcut-skipback')
} else {var SkipBack_KeyboardShortcut = 'j'}
if (video.getAttribute('keyboard-shortcut-skipforth'))
{var SkipForth_KeyboardShortcut = video.getAttribute('keyboard-shortcut-skipforth')
} else {var SkipForth_KeyboardShortcut = 'l'}
/// Defaults
function keyboardShortcuts(event) { function keyboardShortcuts(event) {
const { key } = event const { key } = event
switch(key) { if (key === PlayPause_KeyboardShortcut) {
case 'k':
Toggle_PlayPause() Toggle_PlayPause()
if (video.paused) { if (video.paused) {
Show_Controls() Show_Controls()
} else { } else {
setTimeout(() => { setTimeout(() => {
Hide_Controls() Hide_Controls()
}, 1200) }, 1200)
} }
break }
case 'm': else if (key === Mute_KeyboardShortcut) {
Toggle_Mute() Toggle_Mute()
break }
case 'f': else if (key === Fullscreen_KeyboardShortcut) {
Toggle_Fullscreen() Toggle_Fullscreen()
break }
case 'j': else if (key === SkipBack_KeyboardShortcut) {
Toggle_SkipBack() Toggle_SkipBack()
break }
case 'l': else if (key === SkipForth_KeyboardShortcut) {
Toggle_SkipForth() Toggle_SkipForth()
break
} }
} }
document.addEventListener('keyup', keyboardShortcuts) document.addEventListener('keyup', keyboardShortcuts)

BIN
test/Ennie-and-Yoyki.webm Normal file

Binary file not shown.

View file

@ -9,7 +9,7 @@
<body> <body>
<p>Plyx Player <span>By SudoVanilla</span></p> <p>Plyx Player <span>By SudoVanilla</span></p>
<div class="video-container"> <div class="video-container">
<video class="plyx-player" src="https://sudovanilla.org/content/videos/webm/Ennie-and-Yoyki.webm"></video> <video class="plyx-player" src="Ennie-and-Yoyki.webm"></video>
</div> </div>
<div class="credits"> <div class="credits">
<p><a href="https://youtu.be/MuyJtxzyU3o">Ennie and Yoyki: Ungirly Games</a> <span>By Daniyar Yambushev</span></p> <p><a href="https://youtu.be/MuyJtxzyU3o">Ennie and Yoyki: Ungirly Games</a> <span>By Daniyar Yambushev</span></p>