fix: keep autoplay fallback from saving mute

(cherry picked from commit f373bb9ce7)
This commit is contained in:
thePR0M3TH3AN committed 2026-07-26 12:33:57 -04:00
1 parent 0513c7fcd8
commit d8e5113efd
7 files changed
+96 -10

No files matched your search

+15 -1
View File
@@ -1,6 +1,10 @@
import { userLogger } from "../utils/logger.js";
import { PLAYBACK_START_TIMEOUT } from "../constants.js";
import { getCurrentVideo, setCurrentVideo } from "../state/appState.js";
import {
consumeAutoplayFallbackMute,
muteForAutoplayFallback,
} from "../utils/autoplayPreference.js";
import {
SimpleEventEmitter,
extractWebSeedsFromMagnet,
@@ -330,11 +334,17 @@ export class PlaybackService {
return;
}
const storedUnmuted = localStorage.getItem("unmutedAutoplay");
const userWantsUnmuted = storedUnmuted === "true";
// Sound is the default for an explicit watch action. Browsers may still
// reject unmuted autoplay, in which case the coordinator retries muted.
// Preserve a viewer's explicit mute choice across subsequent videos.
const userWantsUnmuted = storedUnmuted !== "false";
videoElement.muted = !userWantsUnmuted;
if (!videoElement.dataset.autoplayBound) {
videoElement.addEventListener("volumechange", () => {
if (consumeAutoplayFallbackMute(videoElement)) {
return;
}
localStorage.setItem(
"unmutedAutoplay",
(!videoElement.muted).toString()
@@ -344,6 +354,10 @@ export class PlaybackService {
}
}
muteForAutoplayFallback(videoElement) {
return muteForAutoplayFallback(videoElement);
}
/**
* Registers a set of event listeners ("watchdogs") on the video element to detect
* when playback has stalled or failed.