kjfdalshf

This commit is contained in:
legop3
2026-02-21 18:20:02 -05:00
parent d3a17608af
commit abd337f723
3 changed files with 37 additions and 10 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-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-D8STCiny.js"></script> <script type="module" crossorigin src="/assets/index-CxgQu649.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Bz1ixYh7.css"> <link rel="stylesheet" crossorigin href="/assets/index-Bz1ixYh7.css">
</head> </head>
<body> <body>
+27
View File
@@ -63,6 +63,8 @@ export default function VideoTile({
const audioGraphConnectedRef = useRef(false); const audioGraphConnectedRef = useRef(false);
const reductionPollRef = useRef(null); const reductionPollRef = useRef(null);
const graphFailedRef = useRef(false); const graphFailedRef = useRef(false);
const audioInteractionSeenRef = useRef(false);
const lastResumeAttemptAtRef = useRef(0);
const [status, setStatus] = useState('idle'); const [status, setStatus] = useState('idle');
const [detail, setDetail] = useState(null); const [detail, setDetail] = useState(null);
const [audioStatus, setAudioStatus] = useState('idle'); const [audioStatus, setAudioStatus] = useState('idle');
@@ -272,6 +274,13 @@ export default function VideoTile({
const resumeAudioContext = useCallback(async () => { const resumeAudioContext = useCallback(async () => {
const ctx = audioContextRef.current; const ctx = audioContextRef.current;
if (!ctx || ctx.state !== 'suspended') return; if (!ctx || ctx.state !== 'suspended') return;
if (!audioInteractionSeenRef.current) {
logAudio('context/resume-skipped-no-interaction');
return;
}
const now = Date.now();
if (now - lastResumeAttemptAtRef.current < 800) return;
lastResumeAttemptAtRef.current = now;
logAudio('context/resume-attempt'); logAudio('context/resume-attempt');
await ctx.resume().catch(() => {}); await ctx.resume().catch(() => {});
if ( if (
@@ -287,6 +296,24 @@ export default function VideoTile({
logAudio('context/resume-result'); logAudio('context/resume-result');
}, [logAudio, autoLevelEnabled, autoLevelMode, effectiveRoverGain]); }, [logAudio, autoLevelEnabled, autoLevelMode, effectiveRoverGain]);
useEffect(() => {
if (!audioSessionInfo?.url) return undefined;
const markInteraction = () => {
if (audioInteractionSeenRef.current) return;
audioInteractionSeenRef.current = true;
logAudio('interaction/first-user-gesture');
resumeAudioContext();
};
window.addEventListener('pointerdown', markInteraction, { passive: true, capture: true });
window.addEventListener('keydown', markInteraction, { capture: true });
window.addEventListener('touchstart', markInteraction, { passive: true, capture: true });
return () => {
window.removeEventListener('pointerdown', markInteraction);
window.removeEventListener('keydown', markInteraction);
window.removeEventListener('touchstart', markInteraction);
};
}, [audioSessionInfo?.url, logAudio, resumeAudioContext]);
const ensurePlayback = useCallback(async () => { const ensurePlayback = useCallback(async () => {
const video = videoRef.current; const video = videoRef.current;
if (!video) return; if (!video) return;