Hello, I'm trying to import a video file into my page from a collection. So my path looks like this '../assets/wsr-website/demo.webm'. I would like to get a public link for this file so I can put it on the page, but I can't find how.
Here is how I import videos into my markdown collection file :
---
videos: [
{
src: '../assets/wsr-website/demo.webm',
cover: '../assets/wsr-website/cover.jpg'
}
]
---
And here is the zod type I wrote:
videos: z.array(z.object({
src: z.string(),
cover: image()
})).optional(),
Finally, here is what I was trying to do on my astro file:
let fetchedVideos: any[] = [];
if (videos) {
console.log(videos);
fetchedVideos = videos.map(async (videoSrc) => {
const projectsAssetsSrc = '/src/content/projects/assets/';
// If there is ../ in the src, we need to remove it to
let correctSrc = videoSrc.src.replace('../', '');
// We want import the file to get the metadata
});
}
How can I import videos files and get a public link ?