H5 去掉controls ,实现点击视频播放/暂停

This commit is contained in:
北枳 2025-10-06 17:53:06 +08:00
parent 444e8bc58e
commit 991b5a8682

View File

@ -218,17 +218,20 @@ export function H5MediaViewer({
<>
<video
ref={(el) => (videoRefs.current[idx] = el)}
className="w-full h-full object-contain [transform:translateZ(0)] [backface-visibility:hidden] [will-change:transform] bg-black"
className="w-full h-full object-contain [transform:translateZ(0)] [backface-visibility:hidden] [will-change:transform] bg-black cursor-pointer"
style={{
maxHeight: '100%',
}}
src={url}
preload="metadata"
playsInline
controls={isPlaying && activeIndex === idx}
loop
poster={getFirstFrame(url)}
crossOrigin="anonymous"
onClick={(e) => {
e.stopPropagation();
if (activeIndex === idx) togglePlay();
}}
onLoadedMetadata={() => {}}
onPlay={() => {
if (activeIndex === idx) setIsPlaying(true);