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)
// 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) {
const { key } = event
switch(key) {
case 'k':
if (key === PlayPause_KeyboardShortcut) {
Toggle_PlayPause()
if (video.paused) {
Show_Controls()
} else {
setTimeout(() => {
setTimeout(() => {
Hide_Controls()
}, 1200)
}, 1200)
}
break
case 'm':
}
else if (key === Mute_KeyboardShortcut) {
Toggle_Mute()
break
case 'f':
}
else if (key === Fullscreen_KeyboardShortcut) {
Toggle_Fullscreen()
break
case 'j':
}
else if (key === SkipBack_KeyboardShortcut) {
Toggle_SkipBack()
break
case 'l':
}
else if (key === SkipForth_KeyboardShortcut) {
Toggle_SkipForth()
break
}
}
document.addEventListener('keyup', keyboardShortcuts)

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

Binary file not shown.

View file

@ -9,7 +9,7 @@
<body>
<p>Plyx Player <span>By SudoVanilla</span></p>
<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 class="credits">
<p><a href="https://youtu.be/MuyJtxzyU3o">Ennie and Yoyki: Ungirly Games</a> <span>By Daniyar Yambushev</span></p>