Skip to main content
Language

Configure Trim

VideoEditor SDK for React Native supports configuring the trim tool to enforce a minimum and maximum duration of the trimmed video. For a detailed explanation of how to configure different editor views, refer to this guide.

Min / Max Duration#

By default, no minimum or maximum video durations are enforced. In cases where you need to restrict the user from shortening the video below a specific minimum duration or importing a video that is too long, you can use the maximumDuration and minimumDuration options. The unit is seconds, so in this example, we only allow videos that are at least two seconds and at most five seconds long.

Behavior and user alerts for exceptions#

If enabled, the trim length will initially be set to the maximumDuration. If this value is not set, or the video length is shorter than the maximumDuration, it will be set to the full length of the video. The user interface will not allow a trim length that is shorter than minimumDuration or longer than maximumDuration, so users will never be able to generate a video that lies outside these defined limits. However, there are two cases where this behavior can only be achieved with an alert:

  1. If a minimumDuration has been set for the trim tool and the length of the input video is shorter than that, we will present an alert as soon as the editor is opened stating that the video is too short. After confirming that alert, the editor will be closed and an error will be thrown.
  2. If a minimumDuration has been set for the composition tool and the length of the video composition does not yet overstep that length, tapping on the export button will present an alert that notifies the user that they will have to add additional videos to the composition to export the video. After confirming the alert, the composition tool will automatically open. If you do not allow your users to add additional videos to the composition when configuration.composition.personalVideoClips is set to false and no predefined video libraries have been configured, the behavior will be identical as if the trim tool would have been used above.