mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-17 10:00:46 -04:00
wa
This commit is contained in:
File diff suppressed because one or more lines are too long
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-BkBPhgTa.js"></script>
|
<script type="module" crossorigin src="/assets/index-B-zhHWLf.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-Bz1ixYh7.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-Bz1ixYh7.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ export default function VideoTile({
|
|||||||
const audioSourceNodeRef = useRef(null);
|
const audioSourceNodeRef = useRef(null);
|
||||||
const audioCompressorRef = useRef(null);
|
const audioCompressorRef = useRef(null);
|
||||||
const audioGainRef = useRef(null);
|
const audioGainRef = useRef(null);
|
||||||
|
const audioGraphConnectedRef = useRef(false);
|
||||||
const reductionPollRef = useRef(null);
|
const reductionPollRef = useRef(null);
|
||||||
const graphFailedRef = useRef(false);
|
const graphFailedRef = useRef(false);
|
||||||
const [status, setStatus] = useState('idle');
|
const [status, setStatus] = useState('idle');
|
||||||
@@ -248,13 +249,16 @@ export default function VideoTile({
|
|||||||
if (!audioGainRef.current) {
|
if (!audioGainRef.current) {
|
||||||
audioGainRef.current = ctx.createGain();
|
audioGainRef.current = ctx.createGain();
|
||||||
}
|
}
|
||||||
|
if (!audioGraphConnectedRef.current) {
|
||||||
audioSourceNodeRef.current.disconnect();
|
audioSourceNodeRef.current.disconnect();
|
||||||
audioCompressorRef.current.disconnect();
|
audioCompressorRef.current.disconnect();
|
||||||
audioGainRef.current.disconnect();
|
audioGainRef.current.disconnect();
|
||||||
audioSourceNodeRef.current.connect(audioCompressorRef.current);
|
audioSourceNodeRef.current.connect(audioCompressorRef.current);
|
||||||
audioCompressorRef.current.connect(audioGainRef.current);
|
audioCompressorRef.current.connect(audioGainRef.current);
|
||||||
audioGainRef.current.connect(ctx.destination);
|
audioGainRef.current.connect(ctx.destination);
|
||||||
|
audioGraphConnectedRef.current = true;
|
||||||
logAudio('graph/connected');
|
logAudio('graph/connected');
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
graphFailedRef.current = true;
|
graphFailedRef.current = true;
|
||||||
@@ -268,8 +272,17 @@ export default function VideoTile({
|
|||||||
if (!ctx || ctx.state !== 'suspended') return;
|
if (!ctx || ctx.state !== 'suspended') return;
|
||||||
logAudio('context/resume-attempt');
|
logAudio('context/resume-attempt');
|
||||||
await ctx.resume().catch(() => {});
|
await ctx.resume().catch(() => {});
|
||||||
|
if (
|
||||||
|
ctx.state === 'running' &&
|
||||||
|
autoLevelEnabled &&
|
||||||
|
autoLevelMode === 'compressor' &&
|
||||||
|
audioGainRef.current
|
||||||
|
) {
|
||||||
|
audioGainRef.current.gain.value = effectiveRoverGain;
|
||||||
|
logAudio('context/gain-restored', { gain: effectiveRoverGain });
|
||||||
|
}
|
||||||
logAudio('context/resume-result');
|
logAudio('context/resume-result');
|
||||||
}, [logAudio]);
|
}, [logAudio, autoLevelEnabled, autoLevelMode, effectiveRoverGain]);
|
||||||
|
|
||||||
const forceUnlockCompressorAudio = useCallback(async () => {
|
const forceUnlockCompressorAudio = useCallback(async () => {
|
||||||
if (!audioSessionInfo?.url || !autoLevelEnabled || autoLevelMode !== 'compressor') return;
|
if (!audioSessionInfo?.url || !autoLevelEnabled || autoLevelMode !== 'compressor') return;
|
||||||
@@ -393,6 +406,7 @@ export default function VideoTile({
|
|||||||
clearTimeout(unmuteTimer.current);
|
clearTimeout(unmuteTimer.current);
|
||||||
clearInterval(audioPlayInterval.current);
|
clearInterval(audioPlayInterval.current);
|
||||||
clearInterval(reductionPollRef.current);
|
clearInterval(reductionPollRef.current);
|
||||||
|
audioGraphConnectedRef.current = false;
|
||||||
audioSourceNodeRef.current?.disconnect?.();
|
audioSourceNodeRef.current?.disconnect?.();
|
||||||
audioCompressorRef.current?.disconnect?.();
|
audioCompressorRef.current?.disconnect?.();
|
||||||
audioGainRef.current?.disconnect?.();
|
audioGainRef.current?.disconnect?.();
|
||||||
|
|||||||
Reference in New Issue
Block a user