This commit is contained in:
legop3
2026-02-21 17:52:52 -05:00
parent a76062b873
commit d2904f067c
3 changed files with 12 additions and 62 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -11,7 +11,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" />
<title>Multi Roomba Rover</title>
<script type="module" crossorigin src="/assets/index-CaoPznJ4.js"></script>
<script type="module" crossorigin src="/assets/index-Bos19LVi.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Bz1ixYh7.css">
</head>
<body>
+2 -52
View File
@@ -286,56 +286,6 @@ export default function VideoTile({
logAudio('context/resume-result');
}, [logAudio, autoLevelEnabled, autoLevelMode, effectiveRoverGain]);
const forceUnlockCompressorAudio = useCallback(async () => {
if (!audioSessionInfo?.url || !autoLevelEnabled || autoLevelMode !== 'compressor') return;
const graphReady = ensureAudioGraph();
if (!graphReady) {
logAudio('unlock/no-graph');
return;
}
await resumeAudioContext();
const target = audioRef.current;
const gainNode = audioGainRef.current;
if (gainNode) {
gainNode.gain.value = effectiveRoverGain;
}
if (!target) {
logAudio('unlock/no-audio-element');
return;
}
// Compressor mode uses graph-only output.
target.volume = 0;
target.muted = false;
target
.play()
.then(() => logAudio('unlock/force-play-ok'))
.catch((err) => logAudio('unlock/force-play-fail', { error: err?.message }));
}, [
audioSessionInfo?.url,
autoLevelEnabled,
autoLevelMode,
ensureAudioGraph,
resumeAudioContext,
effectiveRoverGain,
logAudio,
]);
useEffect(() => {
if (!audioSessionInfo?.url || !autoLevelEnabled || autoLevelMode !== 'compressor') {
return undefined;
}
const interval = setInterval(() => {
const ctx = audioContextRef.current;
const statusActive = ['connecting', 'connected', 'playing', 'paused'].includes(audioStatus);
if (!statusActive) return;
if (!ctx || ctx.state !== 'running') {
logAudio('unlock/interval');
forceUnlockCompressorAudio();
}
}, 1000);
return () => clearInterval(interval);
}, [audioSessionInfo?.url, autoLevelEnabled, autoLevelMode, audioStatus, forceUnlockCompressorAudio, logAudio]);
const ensurePlayback = useCallback(async () => {
const video = videoRef.current;
if (!video) return;
@@ -478,8 +428,8 @@ export default function VideoTile({
const compressor = audioCompressorRef.current;
const gainNode = audioGainRef.current;
const contextRunning = audioContextRef.current?.state === 'running';
// Compressor mode is graph-only: do not route direct element output.
audioEl.volume = 0;
// Keep direct element audio until WebAudio is actually running in Chrome.
audioEl.volume = contextRunning ? 0 : effectiveRoverGain;
logAudio('route/graph', { contextRunning, elementVolume: audioEl.volume });
if (gainNode) {
const graphGain = contextRunning