fix. 배경 비디오 currentTime 조절 추가
This commit is contained in:
@@ -35,6 +35,16 @@ const gradientClasses = computed(() => [
|
||||
props.gradient,
|
||||
])
|
||||
|
||||
// 비디오를 처음부터 재생하는 메서드
|
||||
const restartVideo = () => {
|
||||
if (!videoRef.value) return
|
||||
|
||||
videoRef.value.currentTime = 0
|
||||
videoRef.value.play().catch(err => {
|
||||
console.warn('Video play failed:', err)
|
||||
})
|
||||
}
|
||||
|
||||
// src 변경 시 비디오 다시 로드
|
||||
watch(videoSrc, () => {
|
||||
if (!videoRef.value) return
|
||||
@@ -42,6 +52,10 @@ watch(videoSrc, () => {
|
||||
videoRef.value.currentTime = 0
|
||||
videoRef.value.load()
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
restartVideo,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user