parent
e4472c7f9f
commit
38f9458ff3
6 changed files with 121 additions and 95 deletions
@ -0,0 +1,35 @@ |
||||
import { useEffect } from 'react'; |
||||
|
||||
const useVideoCallback = (videoPr: any, videoFlow: any, handle: any) => { |
||||
const { isPlay, currentTime, isEndEd } = videoPr; |
||||
const { progressSliderChangeVal } = videoFlow; |
||||
const { onProgressSlide, onPlay, onPause, onTimeChange, onEndEd } = handle; |
||||
|
||||
useEffect(() => { |
||||
if (videoFlow.progressSliderChangeVal) { |
||||
onProgressSlide && onProgressSlide(progressSliderChangeVal); |
||||
} |
||||
}, [progressSliderChangeVal]); |
||||
|
||||
useEffect(() => { |
||||
if (isPlay) { |
||||
onPlay && onPlay(isPlay); |
||||
} else { |
||||
onPause && onPause(isPlay); |
||||
} |
||||
}, [isPlay]); |
||||
|
||||
useEffect(() => { |
||||
if (currentTime) { |
||||
onTimeChange && onTimeChange(currentTime); |
||||
} |
||||
}, [currentTime]); |
||||
|
||||
useEffect(() => { |
||||
if (isEndEd) { |
||||
onEndEd && onEndEd(isEndEd); |
||||
} |
||||
}, [isEndEd]); |
||||
}; |
||||
|
||||
export default useVideoCallback; |
Loading…
Reference in new issue