VideoEditor SDK supports several configuration options for the transform tool allowing flexible adaptation to different needs and use cases. For a detailed explanation of how to configure different editor views, refer to this guide.
The default configuration includes several different crop aspect ratios users can choose from. In order to restrict those to specific aspect ratios only, for instance, those used by social networks (e.g. Facebook, Twitter, Instagram, Flickr), we can specify aspect ratios as
CropRatios and give it the desired
name argument to the
CropRatio constructor allows using a custom name for the crop ratio.
Note that setting the aspect ratio will not affect the resolution of the video.
While it is possible to configure the available preset aspect ratios for cropping, we can also disable free cropping to ensure that the video will always choose one of the available aspect ratios by setting
When free-crop is enabled, users need a way to reset the applied transform operations.
In our example, since we are enforcing a certain set of aspect ratios, we can disable the reset button by setting
Since in this example we enforce a certain set of aspect ratios, we need to ensure that one of the crop options is selected before any other editing operations are applied.
To this end, we configure the editor by setting
This ensures that the transform tool is presented first if the selected video does not fit one of the allowed aspect ratios.