fix. loading, preload 추가
This commit is contained in:
@@ -7,6 +7,13 @@ interface Props {
|
||||
loop?: boolean
|
||||
bordered?: boolean
|
||||
class?: string
|
||||
/**
|
||||
* 비디오 데이터 로딩 시점
|
||||
* - none: 재생 전까지 로드 안 함 (가장 절약)
|
||||
* - metadata: 길이·크기 등 메타만 로드
|
||||
* - auto: 재생에 맞게 미리 로드 (autoplay 시 권장)
|
||||
*/
|
||||
preload?: 'none' | 'metadata' | 'auto'
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
@@ -16,6 +23,10 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
bordered: true,
|
||||
})
|
||||
|
||||
const effectivePreload = computed(
|
||||
() => props.preload ?? (props.play ? 'auto' : 'none')
|
||||
)
|
||||
|
||||
const videoRef = ref<HTMLVideoElement | null>(null)
|
||||
const pauseTimer = ref<ReturnType<typeof setTimeout> | null>(null)
|
||||
|
||||
@@ -119,6 +130,7 @@ onBeforeUnmount(() => {
|
||||
:poster="props.poster"
|
||||
:loop="props.loop"
|
||||
:autoplay="props.play"
|
||||
:preload="effectivePreload"
|
||||
muted
|
||||
playsinline
|
||||
webkit-playsinline
|
||||
|
||||
Reference in New Issue
Block a user