New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set crop programmatically #10
Comments
Yes, you can. You are going to use the VideoEditorController. final controller = VideoEditorController();
//Without notifyListeners()
controller.maxCrop = Offset(0.75, 0.75);
controller.minCrop = Offset(0.25, 0.25);
//With notifyListeners()
controller.updateCrop(Offset(0.25, 0.25), Offset(0.75, 0.75)); |
Indeed, the crop work nicely, I hadn't noticed that the offsets had to be between 0 and 1. _controller = VideoEditorController.file(widget.file, trimStyle: trimStyle, cropStyle: cropStyle);
_controller.updateCrop(Offset(0.0, 0.1), Offset(1.0, 0.9));
_controller.initialize().then((_) {
setState(() {});
}); But it looks like that the Is there a way to hide those rectangles without having to set the same background color to the rectangles and the app ? |
The .updateCrop() has a notifyListeners(). The nofitfy is like a setState() then the widget needs to be mounted. Exactly, the minCrop and maxCrop need to be in range between 0 and 1.0, because the view size always change. For example, the TrimSlider thumbnails view size don't the same on ScreenCrop view size also the Original Video has a other size. //initState's using notifyListeners()
@override
void initState() {
_controller = VideoEditorController.file(widget.file);
_controller.initialize().then((_) {
_controller.updateCrop(Offset(0.0, 0.1), Offset(1.0, 0.9));
setState(() {});
});
}
});
//initState is not using notifyListeners()
@override
void initState() {
_controller = VideoEditorController.file(widget.file);
_controller.minCrop = Offset(0.0, 0.1);
_controller.maxCrop = Offset(1.0, 0.9);
_controller.initialize().then((_) => setState(() {}));
} |
Hello @seel-channel , excellent work and it has absolutely saved my life on a project I'm working on. I have a similar question, how do I go about making the CropGrid static with a predefined aspectRatio but enable the scale and pan gestures on the video. I'm try to achieve an effect similar to that of Instagram picker or this imagePlugin. |
It don't has a way to set a preferredWidth or preferredHeight like aspectRatio. In the next update I will add this feature |
Yes and what i meant is that the video and the thumbnails are indeed cropped correctly but the extra spaces (in blue in my example) which come from the previous video size should not be displayed. and i can't access to _controller.minCrop = Offset(0.0, 0.1);
_controller.maxCrop = Offset(1.0, 0.9); because there is no setters for those references. Do you think it is something that could be fix in the next update ? |
Thanks a lot man. I look forward to the next update. Would also be nice to enable gestures on the actual video as well. Thanks for a great plugin. |
Hi friend. Tell me, how soon is the update coming out with this feature? We really need the ability to set a preferredWidth or preferredHeight like aspectRatio like of this plugin image_crop This is a very cool plugin. I'm really looking forward to the update) |
In 2 days |
Thank you 🙏. We count on you very much! |
I need more time. The package crash lol |
Yes I also have this same issue sometimes. I'll add validations for this error and I think will solve it |
May I know the reason for this issue... though... Maybe I can fix it and send a code snippet... |
Please send me your code. I would like a lot :) |
The FFMPEG make me crash the app. I think is a incompatible with Flutter 2.0.1. For this problem I couldn't release the new crop features |
what if we created a native libary based on this and expose... |
dart code... |
Sounds really funny! But I don't have any knowledge about native libraries |
Can't you use the old version of FFMPEG and temporarily not switch to nullsafity? So that we can take advantage of your new functions)) By the way, yesterday the flutter_ffmpeg library was updated to version 0.4.0. Maybe they fixed the mistake, what do you think? Haven't checked it yet? |
Hi friend. Do you have news for us? |
Done! Check the new release |
First, thank you for this well-build library.
Could it be possible to define the crop of the video programmatically (without user interaction) by providing a Rect object to the CropGrid for example ?
For example, I'm looking to have all my videos cropped to a square format and I would like to do this without user interaction.
Is there anyway to implements that kind of feature ?
Thank you!
The text was updated successfully, but these errors were encountered: