#Problem with <video> anchor on astro web page

21 messages · Page 1 of 1 (latest)

loud escarp
#

Hello, do someone know how to put a video on astro web page? i keep having this error

Is there a specific doc from astro to handle that please? been grinding this for a solid 30min via internet/copilot/gpt

onyx rain
#

What video Format are you using?

loud escarp
#

mp4

onyx rain
#

Can you provide a snipped of your code?

loud escarp
#

of course

#

tried like that before didnt work

#

just saw a syntax error in my first screen

#

but still doesnt work

onyx rain
#

Ok so what happened is astro is searching for the Video in your public directory of the project. Try importing the video 'import myVideo from "./yellow_anim.mp4" at the top and then set your source to myVideo

loud escarp
#

will do as you say rn

onyx rain
#

Im astro if you provide a filepath for image or video inside of your html it will always try to find it in the public directory of your project not in the current folder of the file you are trying to import it from.

loud escarp
#

i did try earlier in the public directory but it didnt work so i tried with a video that put in the same directory, to see if the bug was here

loud escarp
#

it looks like he doesnt read it

onyx rain
#

Use src={myVideo} as an object not String

loud escarp
#

ofc sry 🥲

onyx rain
#

Np

loud escarp
#

it works ty life savior

onyx rain
#

No Problem Happy coding