Compare commits
No commits in common. "5d5e828980b1c8df80966a7806adb3eccc17241a" and "2aac3befd4a13a401bd8de320eea2eb91d0d442d" have entirely different histories.
5d5e828980
...
2aac3befd4
@ -6,6 +6,7 @@ export default function VideoPlayer() {
|
||||
const { id } = useParams<{ id: string }>()
|
||||
const videoId = id ? parseInt(id, 10) : null
|
||||
const videoRef = useRef<HTMLVideoElement>(null)
|
||||
const [isPlaying, setIsPlaying] = useState(false)
|
||||
const [showPlayButton, setShowPlayButton] = useState(true)
|
||||
|
||||
const videoUrl = videoId ? videosApi.getVideoUrl(videoId) : ''
|
||||
@ -13,11 +14,13 @@ export default function VideoPlayer() {
|
||||
const handlePlay = () => {
|
||||
if (videoRef.current) {
|
||||
videoRef.current.play()
|
||||
setIsPlaying(true)
|
||||
setShowPlayButton(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handlePause = () => {
|
||||
setIsPlaying(false)
|
||||
setShowPlayButton(true)
|
||||
}
|
||||
|
||||
@ -31,14 +34,17 @@ export default function VideoPlayer() {
|
||||
if (!video) return
|
||||
|
||||
const handlePlayEvent = () => {
|
||||
setIsPlaying(true)
|
||||
setShowPlayButton(false)
|
||||
}
|
||||
|
||||
const handlePauseEvent = () => {
|
||||
setIsPlaying(false)
|
||||
setShowPlayButton(true)
|
||||
}
|
||||
|
||||
const handleEnded = () => {
|
||||
setIsPlaying(false)
|
||||
setShowPlayButton(true)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user