Baseflow / screenrecorder

Flutter package which can be used to record flutter widgets
https://pub.dev/packages/screen_recorder
MIT License
64 stars 30 forks source link

feat: allow export as RawFrame #19

Closed omartinma closed 1 year ago

omartinma commented 1 year ago

Closes #18

omartinma commented 1 year ago

Another approach to avoid the dependency between Exporter and ScreenRecorderController might be move the logic of onNewFrame to the controller. Then the user whenever wants to export will simply create a Exporter with the frames as parameter in the constructor. This way will simplify testing in the future as well. @ueman

ueman commented 1 year ago

Another approach to avoid the dependency between Exporter and ScreenRecorderController might be move the logic of onNewFrame to the controller. Then the user whenever wants to export will simply create a Exporter with the frames as parameter in the constructor. This way will simplify testing in the future as well. @ueman

I don't think that's the way to go. I'm currently experimenting with a sticky background isolate, which does the processing right at the time of the arrival of new frames. That makes exporting a gif way faster.

But apart from that I agree. It would make everything easier, but it would also limit you in other ways. Maybe the controller.export should just return the exporter. Then you could also write an exporter, which nests multiple other exporters which then enables exporting to various formats

omartinma commented 1 year ago

Another approach to avoid the dependency between Exporter and ScreenRecorderController might be move the logic of onNewFrame to the controller. Then the user whenever wants to export will simply create a Exporter with the frames as parameter in the constructor. This way will simplify testing in the future as well. @ueman

I don't think that's the way to go. I'm currently experimenting with a sticky background isolate, which does the processing right at the time of the arrival of new frames. That makes exporting a gif way faster.

But apart from that I agree. It would make everything easier, but it would also limit you in other ways. Maybe the controller.export should just return the exporter. Then you could also write an exporter, which nests multiple other exporters which then enables exporting to various formats

Then I have the feeling that there is too much purpose on the package IMO. For me I see 2 clear paths here:

If they continue coupled with each other I think will prevent the people who dont want to generate the GIF at all to fully use the package.

omartinma commented 1 year ago

Anyway what are your thoughts about the changes on the current API?

ueman commented 1 year ago

Anyway what are your thoughts about the changes on the current API?

I'm still not 100% convinced, but I'm not using it myself, and you're using it, so I'll trust you on this. Let's move on with this and iterate if it doesn't work out. Can you raise the version to 0.2.0 and add a changelog entry?

omartinma commented 1 year ago

Anyway what are your thoughts about the changes on the current API?

I'm still not 100% convinced, but I'm not using it myself, and you're using it, so I'll trust you on this. Let's move on with this and iterate if it doesn't work out. Can you raise the version to 0.2.0 and add a changelog entry?

Changelog updated :D Thanks a lot again! if you prefer we can jump on a call to discuss the API or any other future improvement(I was planning to include support as well for JS workers since the current approach of computing is not working there)