muxinc / upchunk

Uploads Chunks! Takes big files, splits them up, then uploads each one with care (and PUT requests).
MIT License
336 stars 46 forks source link

Uploading from mobile device browser in background #68

Open adrienfloor opened 2 years ago

adrienfloor commented 2 years ago

Hey Guys

Thank you very much for the great work. I'm using Mux with upchunk to direct upload videos from my React web app. So far it's been very positive, and I didn't have any problem to implement it for desktop web. That being said, I have a big problem using the web app on mobile devices :

as soon I switch from my browser application to another application and therefore put the browser app in "background-mode", the upload stops. It resumes when I make the browser come back to foreground. I've tried this on Chrome && Safari.

This is very annoying for large video files because it means that when a user uploads a video, he has to wait for the upload to be complete before doing anything else with his phone ... which is very bad ! 😢

Can anyone give me a hand here ? Or some tips on what to do ? I implemented the whole thing on a web client because I had the exact same problem with my react-native app... so it's quite a bummer.

I'm willing to submit a PR if someone can guide me on what do, and I can review anything 😊

Thanks a lot !

adrienfloor commented 2 years ago

So I figured out that you can't really process requests from a mobile browser while it is in background. My apologies for not knowing that before posting this issue.

It is ok for the upload to pause when the user puts the browser in background, but the progress event jumps backwards every time I do this. I found that to be an issue happening in the past (and being resolved here : #43 ) . Though, it looks like it is happening under the circumstances I describe. The correct behaviour would be for the upload and progress event to pause when browser app goes in background mode, and resume from where it stopped when browser app goes back to foreground mode.

Does anyone know what I could do ? Or where does this problem comes from ? Thank you all very much.

davekiss commented 2 years ago

Hey @adrienfloor thanks for your note. Can you confirm which mobile browsers and operating system this progress reversal is happening on? I will try to reproduce and debug on our end, but I'm wondering if this could be a low-level browser implementation caveat.

adrienfloor commented 2 years ago

Hey @davekiss I'm using an iphone 12pro with iOS 15.1. This is happening on both the last versions of Safari and Chrome mobile browsers. Thank you so much for your help here ! 🙌🏼

h-mergel commented 3 weeks ago

Are there any news to this? We are also wondering, if it is possible to resume the upload after the browser was in background.