update src of audio or video #2180
Answered
by
SimoTod
FrancoisDucobu
asked this question in
1. Help
-
Hello everyone, I discovered alpinejs two weeks ago and i'm loving it. There is a tiny thing I don't understand. here is my code
Do you have any advice or idea to help me ? Thanks, Francois |
Beta Was this translation helpful? Give feedback.
Answered by
SimoTod
Oct 6, 2021
Replies: 1 comment 6 replies
-
it's the default behaviour (not an alpine thing). if you want to change the source at runtime, you need to call the load() method on the video tag. Something like <video autoplay loop muted class="absolute z-10 w-auto min-w-full min-h-full max-w-none" x-init="$watch('data.video', () => $el.load())">
<source :src="data.video" type="video/mp4"/>
</video> |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
FrancoisDucobu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it's the default behaviour (not an alpine thing). if you want to change the source at runtime, you need to call the load() method on the video tag. Something like