How to download a movie file from a collection?

Hi
I have successfully created file download buttons for Word and Excel files, using wixLocation.To (), but I failed doing the same with movies and images files. I used a different fields types at the collection (file for Word and Excel, movie for movies and image for images) but it doesn’t seem to work. Any ideas?
Tnx


Works:

 
wixData.query("docsForDownload")
.eq("title", "doc1")
.find()
.then( (results) => {
wixLocation.to(results.items[0].files);
});

Doesn’t work:

wixData.query("docsForDownload")
.eq("title", "mov1")
.find()
.then( (results) => {
wixLocation.to(results.items[0].movie_file);
});

It’s most likely be cause you need to modify the link, do a console log for results and take a look at it.

I know for images it’ll return an src that can only be used within your site so you need to convert that to a URL you can publicly share so my guess is that it’s the same case for videos.

if it starts with wixsatics/ then you’ll need to modify it so it looks like https://

Thank you! you gave me a hint… I figure it out that way:


let url = (results.items[0].movie_file).split ("/");

wixLocation.to ("https://video.wixstatic.com/video/" + url [3] + "/file");

Do you know how can it be downloaded automatically? now it’s just open a new window and load the video.