forked from 77media/video-flow
H5 去掉controls ,实现点击视频播放/暂停
This commit is contained in:
parent
444e8bc58e
commit
991b5a8682
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user