mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-15 17:12:59 -04:00
ploo
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -11,7 +11,7 @@
|
|||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||||
<meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" />
|
<meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" />
|
||||||
<title>Multi Roomba Rover</title>
|
<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">
|
<link rel="stylesheet" crossorigin href="/assets/index-Bz1ixYh7.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -286,56 +286,6 @@ export default function VideoTile({
|
|||||||
logAudio('context/resume-result');
|
logAudio('context/resume-result');
|
||||||
}, [logAudio, autoLevelEnabled, autoLevelMode, effectiveRoverGain]);
|
}, [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 ensurePlayback = useCallback(async () => {
|
||||||
const video = videoRef.current;
|
const video = videoRef.current;
|
||||||
if (!video) return;
|
if (!video) return;
|
||||||
@@ -478,8 +428,8 @@ export default function VideoTile({
|
|||||||
const compressor = audioCompressorRef.current;
|
const compressor = audioCompressorRef.current;
|
||||||
const gainNode = audioGainRef.current;
|
const gainNode = audioGainRef.current;
|
||||||
const contextRunning = audioContextRef.current?.state === 'running';
|
const contextRunning = audioContextRef.current?.state === 'running';
|
||||||
// Compressor mode is graph-only: do not route direct element output.
|
// Keep direct element audio until WebAudio is actually running in Chrome.
|
||||||
audioEl.volume = 0;
|
audioEl.volume = contextRunning ? 0 : effectiveRoverGain;
|
||||||
logAudio('route/graph', { contextRunning, elementVolume: audioEl.volume });
|
logAudio('route/graph', { contextRunning, elementVolume: audioEl.volume });
|
||||||
if (gainNode) {
|
if (gainNode) {
|
||||||
const graphGain = contextRunning
|
const graphGain = contextRunning
|
||||||
|
|||||||
Reference in New Issue
Block a user