longitachi / ZLPhotoBrowser

Wechat-like image picker. Support select photos, videos, gif and livePhoto. Support edit image and crop video. 微信样式的图片选择器,支持预览/相册内拍照及录视频、拖拽/滑动选择,编辑图片/视频,支持多语言国际化等功能;
MIT License
4.71k stars 950 forks source link

切换摄像头无效 #830

Closed rgmyyw closed 10 months ago

rgmyyw commented 12 months ago
let config = ZLPhotoConfiguration.default()
config.allowSelectImage = true
config.allowSelectVideo = true
config.allowEditImage = false
config.allowEditVideo = true
config.allowMixSelect = false
config.allowTakePhotoInLibrary = true
config.cropVideoAfterSelectThumbnail = true
config.maxSelectCount = 6
config.maxVideoSelectCount = 1
config.maxSelectVideoDuration = 60
config.minSelectVideoDuration = 1
config.maxEditVideoTime = 60
config.showCaptureImageOnTakePhotoBtn = true
config.cameraConfiguration.maxRecordDuration = 60
config.cameraConfiguration.videoExportType = .mp4
config.useCustomCamera = false
rgmyyw commented 12 months ago

canAddInput 貌似一直都是false

if self.session.canAddInput(newVideoInput) {
        self.session.addInput(newVideoInput)
        self.videoInput = newVideoInput
} else {
        self.session.addInput(currInput)
}
rgmyyw commented 12 months ago

系统版本: 15.7.5

hapiii commented 11 months ago

在内部初始化sessionPreset 为hd1920x1080 public var sessionPreset: ZLCameraConfiguration.CaptureSessionPreset = .hd1920x1080

但是部分机型是不支持AVCaptureSessionPreset1920x1080的,所以无法调用addInput

可以试着修改默认配置配置: config.cameraConfiguration.sessionPreset = .photo

或者通过supportsAVCaptureSessionPreset判断支持的Preset