muxinc / upchunk

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

upchunk for ReactNative #33

Closed hossein-zare closed 4 years ago

hossein-zare commented 4 years ago

Hello,

Does this package support ReactNative?

dylanjha commented 4 years ago

Hi @hossein-zare thanks for the question.

No, it does not. Last I checked React Native didn't have some of the top level constructors that this package uses:

I can't remember if it was some or all of those that were not supported in RN. If you're using this with Mux, you can send a PUT request to the upload URL with the file content in the request body. In a similar vein, I have also heard of some folks using Expo's uploadAsync functionality with success, RN itself may have something similar that you can leverage.

adrienfloor commented 3 years ago

Hey @dylanjha I apologise for re-opening this but I've been working a lot on uploading large video files from a react native app to Mux. So far nothing conclusive. I'm not using expo btw, and I need the upload to keep going even if the app goes in background mode (since it can be quite long). I know all about the mux documentation and I'm doing everything right, it's just the upload process itself that has been an unbelievable pain. I've been working on it and trying things for weeks so kinda desperate πŸ˜… could you help me on what to do from here please ? Thank you so much πŸ™ŒπŸΌ

dylanjha commented 3 years ago

Hi @adrienfloor

Have you tried this library: https://github.com/Vydia/react-native-background-upload

It looks like with method: 'PUT' and type: 'raw' that could work.

adrienfloor commented 3 years ago

Yes I did. It's alright for relatively small video files of a few minutes, but for larger it does always fail. The solution would be to compress the file before uploading it but I can't figure out something that compresses efficiently without losing too much quality, I've tried many things, and compressing on the client doesn't seems like a clever choice since MUX is already doing it while processing the file it receives.

hossein-zare commented 3 years ago

Hello again, @adrienfloor You can try https://github.com/hossein-zare/react-native-chunk-upload

Not sure about...

I need the upload to keep going even if the app goes in background mode (since it can be quite long)

adrienfloor commented 3 years ago

I'm working on it right now @hossein-zare, thank you πŸ‘

adrienfloor commented 3 years ago

Hey again @dylanjha We've been trying to use this package with MUX : https://github.com/hossein-zare/react-native-chunk-upload and had some troubles along the way. If you had 5 minute to check this out and give some feedback we would really appreciate it : https://github.com/hossein-zare/react-native-chunk-upload/issues/7 Thanks again πŸ™ŒπŸΌ

nikitph commented 1 year ago

Hello. great job on the library! Has anything changed wrt RN support here?

lucasasalmins commented 1 year ago

also would love some react native support!

Osmanity commented 1 year ago

This mux service is to good for it not being supported in react nativeπŸ™

dylanjha commented 1 year ago

@nikitph @lucasasalmins @Osmanity thanks for your feedback here

A couple things:

First off, we have a slightly better story now for RN. Not a fully baked RN SDK, but we do have Upload SDKs for both iOS and Android now

We have at least 1 customer who has integrating these upload SDKs into their React Native app. I know it's not as nice as you would like. There's a number of resources around bridging native SDKs into RN apps. That might be worth looking into.

We would ❀️ to build a fully RN SDK, or as an intermediate step create some resources to help folks bridge our native uploader SDKs into RN but it's not on the immediate roadmap. Having native SDKs for us is the first step so that when we have the bandwidth we can create a RN SDK that interfaces with these native SDKs that now support.

Secondly, and this might be more helpful for the immediate term is that Mux Direct Upload URLs are Google Cloud Storage URLs. There's nothing special or Mux specific about it. Any RN library that supports uploading to GCS should work just fine with Mux Direct Upload URLs.

Hope that's helpful. Please comment here with your experience to help others who run into the same issue.