forked from forktown/watch-party
Experimental: Prevent default action on outgoing events when debouncing
This commit is contained in:
parent
d446869a28
commit
4dfe6a544d
1 changed files with 5 additions and 2 deletions
|
@ -9,7 +9,7 @@ import { setupChat, logEventToChat } from "./chat.mjs?v=5";
|
|||
const createWebSocket = (sessionId, nickname) => {
|
||||
const wsUrl = new URL(
|
||||
`/sess/${sessionId}/subscribe` +
|
||||
`?nickname=${encodeURIComponent(nickname)}`,
|
||||
`?nickname=${encodeURIComponent(nickname)}`,
|
||||
window.location.href
|
||||
);
|
||||
wsUrl.protocol = { "http:": "ws:", "https:": "wss:" }[wsUrl.protocol];
|
||||
|
@ -73,7 +73,7 @@ const setupIncomingEvents = (video, socket) => {
|
|||
}
|
||||
|
||||
logEventToChat(event);
|
||||
} catch (_err) { }
|
||||
} catch (_err) {}
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -86,6 +86,7 @@ const setupOutgoingEvents = (video, socket) => {
|
|||
|
||||
video.addEventListener("pause", async (event) => {
|
||||
if (outgoingDebounce || !video.controls) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -107,6 +108,7 @@ const setupOutgoingEvents = (video, socket) => {
|
|||
|
||||
video.addEventListener("play", (event) => {
|
||||
if (outgoingDebounce || !video.controls) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -130,6 +132,7 @@ const setupOutgoingEvents = (video, socket) => {
|
|||
}
|
||||
|
||||
if (outgoingDebounce || !video.controls) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue