fix: await nextTick before setting video src on first preview
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, computed } from 'vue'
|
||||
import { ref, watch, computed, nextTick } from 'vue'
|
||||
|
||||
const props = defineProps<{
|
||||
videoUrl: string | null
|
||||
@@ -9,7 +9,8 @@ const videoRef = ref<HTMLVideoElement | null>(null)
|
||||
const playing = ref(false)
|
||||
const paused = ref(false)
|
||||
|
||||
watch(() => props.videoUrl, (url) => {
|
||||
watch(() => props.videoUrl, async (url) => {
|
||||
await nextTick()
|
||||
if (!videoRef.value || !url) return
|
||||
videoRef.value.src = url
|
||||
playing.value = false
|
||||
|
||||
Reference in New Issue
Block a user