VKVideoCropView
public class VKVideoCropView : UIView
A view to preview a video inside an AVPlayer
, with a scroll view to be able to select a specific area of the video.
Simply set the asset
property to load you video inside the view, and use the getImageCropFrame
method to retrieve the
selected frame of the video.
-
The asset being cropped. Setting the property will load the asset in the
AVPlayer
contained in the scroll view.Declaration
Swift
public var asset: AVAsset? { get set }
-
The current aspect ratio of the crop view.
Declaration
Swift
public private(set) var aspectRatio: CGSize { get }
-
The player used in the scroll view. Use it if you want to seek a specific time of your video.
Declaration
Swift
public var player: AVPlayer? { get }
-
Declaration
Swift
required public init?(coder aDecoder: NSCoder)
-
Set the aspect ratio for the cropping box.
Declaration
Swift
public func setAspectRatio(_ aspectRatio: CGSize, animated: Bool)
Parameters
aspectRatio
The desired aspect ratio.
animated
true if you want to animate the change. TODO: the animation glitches sometimes. See Issue #3
-
Get the currently selected frame of the asset. You can then use it to perform the actual cropping of the video or of an isolated image
Declaration
Swift
public func getImageCropFrame() -> CGRect