Is it possible to download an image or video from Safari to the Camera Roll in iOS 13?
Asked Answered
C

1

6

I know the download attribute works but no matter the filetype it just dumps the image/video into the Files.app area that most people don't understand.

Is there a way to get iOS Safari to save an image or video to the Camera Roll that most users are familiar with instead?

Hard to find recent information on this topic.

Claviform answered 31/1, 2021 at 22:1 Comment(4)
This was a horrid change on Apple's part; I haven't found a workaround.Lorenlorena
Does this answer your question? Force iOS to download image from HTML5 Canvas (using pure javascript)Transude
@Transude I'm not OP, but no. It's entirely possible to force a download on iOS, but Apple changed it a while back from going to the user's photo roll to the new "files" app. Most users never look in there, so they just think it didn't work.Lorenlorena
@Rojo, No this isn't from canvas it's purely an image file or video file on the server. Using <a href="./video.mp4" download> a download attribute in the link like that works but the file is downloaded to the obtuse Files.app. I want to know if there there is a Safari specific way to tell it to download to the Camera Roll that most users understand.Claviform
L
0

I ran into the same issue and ended up using something like this:

fetch(videoUrl)
    .then((response) => response.blob())
    .then((blob) => {
        const files = [new File([blob], fileName, { type: "video/mp4" })];
        navigator.share({ files });
    });

The user will see a share sheet with the video where they can choose to save it:

Screenshot with the share UI and video

I have also written up a blog post with some more details here for anyone interested: https://www.audjust.com/blog/video-exports-for-mobile-editing

Lammas answered 12/2, 2024 at 17:48 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.