Fix autoplay (#10099)

This commit is contained in:
Nicolas Mowen 2024-02-27 11:24:15 -07:00 committed by GitHub
parent d94710171d
commit 8663fbba01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -101,10 +101,6 @@ export default function MobileEventView({
const [minimap, setMinimap] = useState<string[]>([]); const [minimap, setMinimap] = useState<string[]>([]);
const minimapObserver = useRef<IntersectionObserver | null>(); const minimapObserver = useRef<IntersectionObserver | null>();
useEffect(() => { useEffect(() => {
if (!contentRef.current) {
return;
}
const visibleTimestamps = new Set<string>(); const visibleTimestamps = new Set<string>();
minimapObserver.current = new IntersectionObserver( minimapObserver.current = new IntersectionObserver(
(entries) => { (entries) => {
@ -130,7 +126,7 @@ export default function MobileEventView({
return () => { return () => {
minimapObserver.current?.disconnect(); minimapObserver.current?.disconnect();
}; };
}, [contentRef]); }, []);
const minimapRef = useCallback( const minimapRef = useCallback(
(node: HTMLElement | null) => { (node: HTMLElement | null) => {
if (!minimapObserver.current) { if (!minimapObserver.current) {
@ -147,8 +143,8 @@ export default function MobileEventView({
); );
const minimapBounds = useMemo(() => { const minimapBounds = useMemo(() => {
const data = { const data = {
start: Math.floor(Date.now() / 1000) - 35 * 60, start: 0,
end: Math.floor(Date.now() / 1000) - 21 * 60, end: 0,
}; };
const list = minimap.sort(); const list = minimap.sort();
@ -217,7 +213,7 @@ export default function MobileEventView({
> >
{currentItems ? ( {currentItems ? (
currentItems.map((value, segIdx) => { currentItems.map((value, segIdx) => {
const lastRow = segIdx == reviewItems[severity].length - 1; const lastRow = segIdx == currentItems.length - 1;
const relevantPreview = Object.values(relevantPreviews || []).find( const relevantPreview = Object.values(relevantPreviews || []).find(
(preview) => (preview) =>
preview.camera == value.camera && preview.camera == value.camera &&