iOS long video clip tool, similar to WeChat moments select and edit videos larger than 15s from albums, and support saving as a local album.
- Support custom UI.
- Simple to use, only need to pass in the URL of the video.
- Small size, low memory.
- Specify it in your Podfile::
pod 'GPVideoClipper-Swift'
- then
pod install
orpod update
。 import GPVideoClipper_Swift
。
if you can't search this repository,try update CocoaPods version or
1.pod cache clean --all
2.rm -rf ~/Library/Caches/CocoaPods
3.pod repo update
Download GPVideoClipper and drag all files to your project.
Init GPVideoClipperController
,then set videoURL and maker,in callback handle new video info .
let clipperController = GPVideoClipperController.clipperWithVideoURL(info[UIImagePickerController.InfoKey.mediaURL] as! URL, makerBlock: { (maker) in
maker.startTime = 0
maker.endTime = 15
maker.clippedVideoMinDuration = 3
maker.clippedVideoMaxDuration = 15
}) { (videoURL, videoAsset, coverImage) in
// handle videoURL,videoAsset,coverImage
let alertController = UIAlertController.init(title: "提示", message: "视频保存成功,请前往相册中查看!", preferredStyle: .alert)
let doneAction = UIAlertAction.init(title: "确定", style: .default) { (action) in
alertController.dismiss(animated: true, completion: nil)
}
alertController.addAction(doneAction)
self.present(alertController, animated: true, completion: nil)
}
self.navigationController?.pushViewController(clipperController, animated: false)
iOS长视频裁剪工具,类似于微信朋友圈从手机相册选择大于15s的视频后进行裁剪,支持另存为至本地相册。
- 支持自定义UI。
- 使用简单,仅需要传入视频的URL。
- 体积小巧,不占用内存空间。
- 在 Podfile 中添加:
pod 'GPVideoClipper-Swift'
- 执行
pod install
或pod update
。 - 导入
import GPVideoClipper_Swift
。
如果搜不到这个库,试着更新CocoaPods版本或者执行下面的操作:
1.pod cache clean --all
2.rm -rf ~/Library/Caches/CocoaPods
3.pod repo update
下载 GPVideoClipper 文件夹所有内容并拖入你的工程中即可.
初始化GPVideoClipperController
,然后赋值videoURL和maker,最后在回调中处理新的视频信息。
let clipperController = GPVideoClipperController.clipperWithVideoURL(info[UIImagePickerController.InfoKey.mediaURL] as! URL, makerBlock: { (maker) in
maker.startTime = 0
maker.endTime = 15
maker.clippedVideoMinDuration = 3
maker.clippedVideoMaxDuration = 15
}) { (videoURL, videoAsset, coverImage) in
// handle videoURL,videoAsset,coverImage
let alertController = UIAlertController.init(title: "提示", message: "视频保存成功,请前往相册中查看!", preferredStyle: .alert)
let doneAction = UIAlertAction.init(title: "确定", style: .default) { (action) in
alertController.dismiss(animated: true, completion: nil)
}
alertController.addAction(doneAction)
self.present(alertController, animated: true, completion: nil)
}
self.navigationController?.pushViewController(clipperController, animated: false)