A VideoTrimmer Control for iOS that supports trimming & scrubbing
This VideoTrimmer Control for iOS allows the user to define how a video should be trimmed by dragging the side handles. When the user is trimming, pausing for a brief moment zooms in on the timeline to allow for greater precision. The timeline shows thumbnails of the video frames, based on AVAsset. Besides trimming, the control also optionallu allows the user to scrub through the video by tapping on the timeline.
The control when not interacting:
The control when the user trimmed the leading and trailing parts:
The control when the user is trimming the leading part:
The control when the user has zoomed in on the timeline:
asset
: the asset to use for thumbnails. Setting this automatically updates the range and selectedRange propertiesvideoComposition
: the AVVideoComposition to use (see AVFoundation)minimumDuration
: the minimal duration that a video can be. The user can't trim a clip shorter than thisrange
: the range of the asset to useselectedRange
: the range that is selected by the user. If nothing is trimmed, is equal to range.progressIndicatorMode
: defines how the progress indicator is shownhiddenOnlyWhenTrimming
,alwaysShown
oralwaysHidden
progress
: the progress of the movie (e.g. current position when playing)horizontalInset
: the inset from the sides where the timeline and thumbs start. Defaults to16
. (Allows for overshooting when zooming)trackBackgroundColor
: background color for the timeline trackthumbRestColor
: background color for the timeline parts where there is no video, but the thumbs rest when not trimmed
trimmingState
:none
if the user is not trimming,leading
if they're trimming from the front,trailing
if they're trimming from the endisZoomedIn
: true is the user zoomed in the timeline while trimmingisScrubbing
: true if the user is scrubbingvisibleRange
: the range that's currently displayed. Could be different from range when zoomed inselectedTime
: the time that's currently selected when trimming
You can configure the following gesture recognizers to require failure of, for example, a UITableView's panGestureRecognizer:
leadingGestureRecognizer
trailingGestureRecognizer
progressGestureRecognizer
thumbnailInteractionGestureRecognizer
VideoTrimmer.didBeginTrimming
: fired when the user started trimmingVideoTrimmer.didEndTrimming
: fired when the user stopped trimmingVideoTrimmer.selectedRangeChanged
: fired when theselectedRange
property changed because of the user trimmingdidBeginScrubbing
: fired when the user started scrubbing through the videodidEndScrubbing
: fired whe nthe user ended scrubbingprogressChanged
: fired when theprogress
property changed because of the user scrubbing