iOS图片、视频选择工具。支持图片视频多选。支持导出实况照片、未压缩的视频。支持视频压缩,视频转实况。
- 支持选择照片,动图,视频,实况照片。
- 支持选择原图和原视频.
- 自定义主体颜色和提示文字.
- 适配暗黑模式.
- 图片,视频和实况预览.
- 图片编辑(涂鸦,贴图,马赛克,裁剪,滤镜).
- 视频压缩,视频水印,视频替换音轨.
- 自定义相机.
- 视频和实况照片互转.
- 多语言(简体中文,繁体中文,英文).
- 相册实时更新.
- 自定义相机添加滤镜.
- 视频编辑.
- iOS 11.0
- Swift 5.x
- Xcode 12.x
pod 'WLPhotoPicker'
class ViewController: UIViewController {
@objc func openPicker() {
// 选择照片
let config = WLPhotoConfig()
let vc = WLPhotoPickerController(config: config)
vc.pickerDelegate = self
self.present(vc, animated: true, completion: nil)
// 视频压缩,水印
let videoUrl = URL(string: "/demo.video")
let outputPath = ""
let manager = VideoCompressManager(avAsset: AVAsset(url: videoUrl), outputPath: outputPath)
manager.frameDuration = 24
manager.compressSize = ._960x540
manager.addWaterMark(image: UIImage.init(named: "bilibili")) { size in
return CGRect(x: 100, y: 100, width: 100, height: 40)
}
manager.exportVideo { videoUrl in
print(videoUrl)
}
// 自定义相机
let vc = CaptureViewController(captureConfig: CaptureConfig())
vc.delegate = self
present(vc, animated: true)
// 视频转实况
LivePhotoGenerator.createLivePhotoFrom(videoURL) { progress in
print(progress)
} completion: { result in
print(result.livePhoto)
}
}
}