|
|
|
@ -8,7 +8,6 @@ import videoEvents from "@/hooks/videoEvents"; |
|
|
|
|
const deviation: number = 1 |
|
|
|
|
const HVideo: FC<HVideoOptions> = (opt: HVideoOptions) => { |
|
|
|
|
let video: Taro.VideoContext |
|
|
|
|
|
|
|
|
|
const [currentTime, setCurrentTime] = useState(0) |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
@ -42,9 +41,13 @@ const HVideo: FC<HVideoOptions> = (opt: HVideoOptions) => { |
|
|
|
|
/** 判断是否进入断点 */ |
|
|
|
|
opt.breakpoint.forEach(d => { |
|
|
|
|
if (time < d + deviation && time > d - deviation) { |
|
|
|
|
video.exitFullScreen() |
|
|
|
|
|
|
|
|
|
video?.pause() |
|
|
|
|
video?.seek(d - deviation) |
|
|
|
|
if (process.env.TARO_ENV === 'h5') { |
|
|
|
|
document?.exitFullscreen() |
|
|
|
|
} |
|
|
|
|
video?.exitFullScreen() |
|
|
|
|
|
|
|
|
|
// if (opt.preview) {
|
|
|
|
|
// Taro.showModal({
|
|
|
|
@ -107,11 +110,14 @@ const HVideo: FC<HVideoOptions> = (opt: HVideoOptions) => { |
|
|
|
|
<Video |
|
|
|
|
id={'myVideo'} |
|
|
|
|
autoplay |
|
|
|
|
enablePlayGesture |
|
|
|
|
autoPauseIfOpenNative |
|
|
|
|
vslideGestureInFullscreen |
|
|
|
|
showCenterPlayBtn |
|
|
|
|
style={{width: '100%', height: '100%', position: "relative"}} |
|
|
|
|
poster={opt?.poster || ''} |
|
|
|
|
src={opt.src} |
|
|
|
|
showRateBtn='swan' |
|
|
|
|
enableProgressGesture={false} |
|
|
|
|
enableProgressGesture={opt.preview} |
|
|
|
|
direction={90} |
|
|
|
|
onTimeUpdate={onTimeUpdate} |
|
|
|
|
onEnded={onEnded} |
|
|
|
|