Fix issue with spacebar pausing in chromium, allow exit fullscreen with f hotkey
This commit is contained in:
@@ -32,8 +32,6 @@ export const set_file = async file => {
|
|||||||
file.availability === "ip_download_limited_captcha_required"
|
file.availability === "ip_download_limited_captcha_required"
|
||||||
) {
|
) {
|
||||||
viewer_type = "rate_limit"
|
viewer_type = "rate_limit"
|
||||||
} else if (!premium_download && $stats.limits.transfer_limit_used > $stats.limits.transfer_limit) {
|
|
||||||
viewer_type = "slow_down"
|
|
||||||
} else {
|
} else {
|
||||||
viewer_type = file_type(file)
|
viewer_type = file_type(file)
|
||||||
}
|
}
|
||||||
@@ -67,7 +65,7 @@ export const seek = delta => {
|
|||||||
</div>
|
</div>
|
||||||
{:else if viewer_type === "abuse"}
|
{:else if viewer_type === "abuse"}
|
||||||
<Abuse bind:this={viewer} on:download></Abuse>
|
<Abuse bind:this={viewer} on:download></Abuse>
|
||||||
{:else if viewer_type === "slow_down"}
|
{:else if !premium_download && $stats.limits.transfer_limit_used > $stats.limits.transfer_limit}
|
||||||
<SlowDown
|
<SlowDown
|
||||||
on:download
|
on:download
|
||||||
file_size={current_file.size}
|
file_size={current_file.size}
|
||||||
|
@@ -83,7 +83,11 @@ const mute = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fullscreen = () => {
|
const fullscreen = () => {
|
||||||
player.requestFullscreen()
|
if (document.fullscreenElement === null) {
|
||||||
|
player.requestFullscreen()
|
||||||
|
} else {
|
||||||
|
document.exitFullscreen()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const keypress = e => {
|
const keypress = e => {
|
||||||
@@ -104,6 +108,14 @@ const keypress = e => {
|
|||||||
fullscreen()
|
fullscreen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const video_keydown = e => {
|
||||||
|
if (e.key === " ") {
|
||||||
|
// Prevent spacebar from pausing playback in Chromium. This conflicts
|
||||||
|
// with our own global key handler, causing the video to immediately
|
||||||
|
// pause again after unpausing.
|
||||||
|
e.stopPropagation()
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window on:keypress={keypress} />
|
<svelte:window on:keypress={keypress} />
|
||||||
@@ -135,6 +147,7 @@ const keypress = e => {
|
|||||||
on:pause={() => playing = false }
|
on:pause={() => playing = false }
|
||||||
on:play={() => playing = true }
|
on:play={() => playing = true }
|
||||||
on:ended={() => dispatch("next", {})}
|
on:ended={() => dispatch("next", {})}
|
||||||
|
on:keydown={video_keydown}
|
||||||
>
|
>
|
||||||
<source src={file.get_href} type={file.mime_type} />
|
<source src={file.get_href} type={file.mime_type} />
|
||||||
</video>
|
</video>
|
||||||
|
@@ -71,8 +71,22 @@ const mute = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fullscreen = () => {
|
const fullscreen = () => {
|
||||||
player.requestFullscreen()
|
if (document.fullscreenElement === null) {
|
||||||
|
player.requestFullscreen()
|
||||||
|
} else {
|
||||||
|
document.exitFullscreen()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const video_keydown = e => {
|
||||||
|
if (e.key === " ") {
|
||||||
|
// Prevent spacebar from pausing playback in Chromium. This conflicts
|
||||||
|
// with our own global key handler, causing the video to immediately
|
||||||
|
// pause again after unpausing.
|
||||||
|
e.stopPropagation()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@@ -101,6 +115,7 @@ const fullscreen = () => {
|
|||||||
on:pause={() => playing = false }
|
on:pause={() => playing = false }
|
||||||
on:play={() => playing = true }
|
on:play={() => playing = true }
|
||||||
on:ended={() => dispatch("open_sibling", 1)}
|
on:ended={() => dispatch("open_sibling", 1)}
|
||||||
|
on:keydown={video_keydown}
|
||||||
>
|
>
|
||||||
<source src={fs_path_url($nav.base.path)} type={$nav.base.file_type} />
|
<source src={fs_path_url($nav.base.path)} type={$nav.base.file_type} />
|
||||||
</video>
|
</video>
|
||||||
|
Reference in New Issue
Block a user