优化视频加载速度

This commit is contained in:
北枳 2025-07-07 12:02:56 +08:00
parent c98ab85e4b
commit 27f18ee5ac
2 changed files with 3 additions and 0 deletions

View File

@ -111,6 +111,8 @@ function VideoGridLayoutComponent({ videos, onEdit, onDelete }: VideoGridLayoutP
loop
muted={isMuted[video.id] !== false} // 默认静音除非明确设置为false
playsInline
preload="auto"
poster={`${video.url}?vframe/jpg/offset/1`}
onLoadedData={() => {
// 设置默认音量
if (videoRefs.current[video.id] && !volume[video.id]) {

View File

@ -171,6 +171,7 @@ function VideoScreenLayoutComponent({ videos }: VideoScreenLayoutProps) {
muted={index === currentIndex ? isMuted : true} // 只有当前视频受状态控制
playsInline
preload="auto"
poster={`${video.url}?vframe/jpg/offset/1`}
onLoadedData={() => {
if (index === currentIndex && videoRefs.current[index]) {
applyVolumeSettings(videoRefs.current[index]!);