capacitor-community / video-recorder

A video recording plugin for Capacitor
MIT License
2 stars 6 forks source link

feat: get base64 data from url #2

Open maximilien0405 opened 4 months ago

maximilien0405 commented 4 months ago

Is your feature request related to a problem? Please describe. Yes it is, but not in this plugin. Currently the Capacitor FileSystem copy() function does not work on android, it crashes the application. I use it to copy the file and paste it in the cache folder so that i can get the file's base64 data (this is the only solution i found that works..)

Describe the solution you'd like A function that would allow me to give it the video url, and then it gives me the base64 data as a response?

Describe alternatives you've considered The only alternative that i have does not work on android.. so that why it would be a great thing to implement ! If it's not possible or not in the scope of the plugin i would understand :)

Additional context /

shiv19 commented 4 months ago

Video files are generally large and it is not a good idea to pass them through the bridge in one go as base 64, you would need to read it in chunk. I'm planning to work on a way to upload the file from the native side itself. But that will likely not be an OSS plugin (I will try my best to make it OSS)

shiv19 commented 4 months ago

@maximilien0405 You can use this plugin to read large files in chunks over the bridge, and then upload from the browser side.

https://github.com/qrclip/capacitor-file-chunk

maximilien0405 commented 4 months ago

@shiv19 Wow that looks quite complicated but also seems like a good solution to handle large files ! Thank I will look into it and try to implement it !

shiv19 commented 4 months ago

@maximilien0405 another option I'm looking at is this:

https://github.com/spoonconsulting/cordova-plugin-background-upload

Use it with https://github.com/danielsogl/awesome-cordova-plugins/tree/master

https://npm.im/@awesome-cordova-plugins/background-upload

This way, you don't need to bring the file over the bridge to begin with. :)