polarby / render

A package to render any native static and moving flutter widgets to exportable formats
https://pub.dev/packages/render
MIT License
50 stars 28 forks source link

Web support #6

Open polarby opened 1 year ago

polarby commented 1 year ago

Currently the main problem is that ffmpeg and this plugin require to write files to a temporary path. The problem is that web does not support file writings or path_provider does not offer a web solution.

A possible solution might be to have a look at how flutter_sound has managed to conquer web.

jayaanandabalaji commented 1 year ago

Currently the main problem is that ffmpeg and this plugin require to write files to a temporary path. The problem is that web does not support file writings or path_provider does not offer a web solution.

A possible solution might be to have a look at how flutter_sound has managed to conquer web.

If FFMPEG is the only problem, Is it possible to use https://pub.dev/packages/ffmpeg_wasm which wraps https://github.com/ffmpegwasm/ffmpeg.wasm JavaScript library? Or will there be any other problem when trying to implement for web? I am planning to try to implement for web.

polarby commented 1 year ago

Great! I didn't know of this package! If you have the knowledge you are the best guy to do this! Thanks a lot!

Right now we write each captured frame to a temporary directory and then process those frames via ffmpeg. As file writing usually is also a problem for web, we might should consider piping them directly to web (not saving, but directly feeding to ffmpeg - a way more effective method, that has not been implemented yet), as mentioned here: #3 (this guy might know more about it). If file writing is not supported by ffmpeg_wasm, maybe another wasm package can help you out there.

I am looking forward to your contribution! I will try to be the best help to you with quickly merging pull requests :) or give you more info regarding the package.

polarby commented 1 year ago

I have used ffmpeg_wasm in another project for a web application. It works great and may be implemented in this plugin.

The following things would need to be done:

  1. Write a universal_ffmpeg.dart file for this plugin, where both mobile & web can be handled. With the basic execution command run(List<String> command) and file management (write file to web ffmpeg).

  2. Reopen and Merge the #15 piping frames ffmpeg (but only exclusively for the web - and maybe even configurable as settings in RenderController)

  3. Configure web & ffmpeg_wasm instructions in index.dart

Time projection: 5-8h (2h code, 3-6 debug)

abdelaziz-mahdy commented 10 months ago

hello @polarby i am interested in web support for this package, any updates for it?

polarby commented 10 months ago

Currently not on my agenda any time soon. The documentation is however there and can be quite easily implemented. If this is an essential feature for you, you may consider adding it yourself:)

abdelaziz-mahdy commented 10 months ago

Currently not on my agenda any time soon. The documentation is however there and can be quite easily implemented. If this is an essential feature for you, you may consider adding it yourself:)

i will see if i can implement it, most probably it will not be the best, but if i got it working i will open the pr