mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
kjfdalshf
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-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>
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user