mirror of
https://github.com/p-stream/p-stream.git
synced 2026-04-12 05:00:51 +00:00
finalize merge of pr
update space bar holding to prevent watch party
This commit is contained in:
parent
746a5c4abb
commit
d0a4ed58c9
2 changed files with 25 additions and 5 deletions
|
|
@ -635,7 +635,9 @@
|
|||
"playback": {
|
||||
"speedLabel": "Playback speed",
|
||||
"title": "Playback settings",
|
||||
"disabled": "(Disabled in watch party)"
|
||||
"disabled": "(Disabled in watch party)",
|
||||
"speedBoosted": "Playback speed boosted to 2x",
|
||||
"speedUnboosted": "Playback speed reset to {{speed}}x"
|
||||
},
|
||||
"quality": {
|
||||
"automaticLabel": "Automatic quality",
|
||||
|
|
|
|||
|
|
@ -159,8 +159,8 @@ export function KeyboardEvents() {
|
|||
if (next) dataRef.current.display?.setPlaybackRate(next);
|
||||
}
|
||||
|
||||
// Handle spacebar press for play/pause and hold for 2x speed
|
||||
if (k === " ") {
|
||||
// Handle spacebar press for play/pause and hold for 2x speed - disabled in watch party
|
||||
if (k === " " && !dataRef.current.isInWatchParty) {
|
||||
// Skip if a button is targeted
|
||||
if (
|
||||
evt.target &&
|
||||
|
|
@ -216,6 +216,24 @@ export function KeyboardEvents() {
|
|||
}, 300); // 300ms delay before boost takes effect
|
||||
}
|
||||
|
||||
// Handle spacebar press for play/pause only in watch party mode
|
||||
if (k === " " && dataRef.current.isInWatchParty) {
|
||||
// Skip if a button is targeted
|
||||
if (
|
||||
evt.target &&
|
||||
(evt.target as HTMLInputElement).nodeName === "BUTTON"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Prevent the default spacebar behavior
|
||||
evt.preventDefault();
|
||||
|
||||
// Simple play/pause toggle
|
||||
const action = dataRef.current.mediaPlaying.isPaused ? "play" : "pause";
|
||||
dataRef.current.display?.[action]();
|
||||
}
|
||||
|
||||
// Video progress
|
||||
if (k === "ArrowRight")
|
||||
dataRef.current.display?.setTime(dataRef.current.time + 5);
|
||||
|
|
@ -284,8 +302,8 @@ export function KeyboardEvents() {
|
|||
const keyupEventHandler = (evt: KeyboardEvent) => {
|
||||
const k = evt.key;
|
||||
|
||||
// Handle spacebar release
|
||||
if (k === " ") {
|
||||
// Handle spacebar release - only handle speed boost logic when not in watch party
|
||||
if (k === " " && !dataRef.current.isInWatchParty) {
|
||||
// If we haven't applied the boost yet but were about to, cancel it
|
||||
if (dataRef.current.isPendingBoostRef.current) {
|
||||
dataRef.current.isPendingBoostRef.current = false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue