import React, { useRef, useCallback } from 'react' import styles from './index.module.scss' import 'media-chrome' import { baseOssUrl } from '@/utils/http' function Zvideo({ src, objFit = 'fill' ,style}: { src: string; objFit?: string,style?: React.CSSProperties }) { const videoRef = useRef(null) const handleTogglePlay = useCallback(() => { const video = videoRef.current if (!video) return if (video.paused) { video.play() } else { video.pause() } }, []) return (
{ if (e.key === ' ' || e.key === 'Enter') { e.preventDefault(); handleTogglePlay() } }} role="button" tabIndex={0} >
/
) } const MemoZvideo = React.memo(Zvideo) export default MemoZvideo