feat: connect YMB APIs and add swipe video player

This commit is contained in:
Zhou Weidong committed 2026-11-10 15:51:04 +08:00
1 parent eb3eb8dfc6
commit 6ba0ce1179
19 files changed
+113 -11

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
// Author: fruit.com.cn
import { useEffect, useRef } from 'react';
export function VideoPlayer({ src, poster, autoPlay = true, muted = true, onProgress }) {
const ref = useRef(null);
useEffect(() => { const video = ref.current; if (!video || !src) return undefined; const attempt = video.play(); attempt?.catch(() => {}); return () => video.pause(); }, [src]);
return <video ref={ref} className="video-player" src={src} poster={poster} controls playsInline autoPlay={autoPlay} muted={muted} onTimeUpdate={(event) => onProgress?.(event.currentTarget.currentTime)} />;
}