相机拍摄页面,将首选项调整为拍摄视频
This commit is contained in:
parent
a898f957f9
commit
3e3f368489
@ -265,14 +265,11 @@ class CCSpatialShootController: BaseController {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
ZZHHelper.setNowTimeToUserDefaultWithKey(kNowTimeToUserDefaultKey_SpatialShootController)
|
||||
// view.backgroundColor = .white
|
||||
|
||||
|
||||
outputVideoURL = URL.documentsDirectory.appendingPathComponent("output.MOV")
|
||||
|
||||
configureSession() // 设置相机参数
|
||||
|
||||
setUI()
|
||||
// showTips()
|
||||
self.view.bringSubviewToFront(navtionImgView!)
|
||||
|
||||
//判断当前是否是横屏
|
||||
@ -295,8 +292,9 @@ class CCSpatialShootController: BaseController {
|
||||
|
||||
//读取相册第一张照片
|
||||
getAlbumFirstPhoto()
|
||||
// orientationDidChange()
|
||||
enableShutterBtn(false)
|
||||
//进入页面的首选项调整为视频拍摄
|
||||
switchButtonAction(videoButton)
|
||||
}
|
||||
|
||||
private func setUI() {
|
||||
@ -349,26 +347,28 @@ class CCSpatialShootController: BaseController {
|
||||
|
||||
cameraButton.snp.makeConstraints { (make) in
|
||||
make.centerY.equalTo(switchBackView.snp.centerY)
|
||||
make.leading.equalTo(switchBackView.snp.leading).offset(4)
|
||||
|
||||
make.trailing.equalTo(switchBackView.snp.trailing).offset(-4)
|
||||
make.width.equalTo(56)
|
||||
make.height.equalTo(32)
|
||||
}
|
||||
|
||||
videoButton.snp.makeConstraints { (make) in
|
||||
make.centerY.equalTo(switchBackView.snp.centerY)
|
||||
make.trailing.equalTo(switchBackView.snp.trailing).offset(-4)
|
||||
make.leading.equalTo(switchBackView.snp.leading).offset(4)
|
||||
make.width.equalTo(56)
|
||||
make.height.equalTo(32)
|
||||
}
|
||||
|
||||
cameraLabel.snp.makeConstraints { (make) in
|
||||
make.bottom.equalTo(switchBackView.snp.top).offset(-8)
|
||||
make.centerX.equalTo(switchBackView.snp.leading).offset(32)
|
||||
|
||||
make.centerX.equalTo(switchBackView.snp.trailing).offset(-32)
|
||||
}
|
||||
|
||||
videoLabel.snp.makeConstraints { (make) in
|
||||
make.bottom.equalTo(switchBackView.snp.top).offset(-8)
|
||||
make.centerX.equalTo(switchBackView.snp.trailing).offset(-32)
|
||||
make.centerX.equalTo(switchBackView.snp.leading).offset(32)
|
||||
}
|
||||
}
|
||||
|
||||
@ -387,12 +387,6 @@ class CCSpatialShootController: BaseController {
|
||||
wideAngleCameraDevice = backCamera
|
||||
|
||||
do {
|
||||
print("builtInWideAngleCamera:\(backCamera.videoZoomFactor)")
|
||||
// try backCamera.lockForConfiguration()
|
||||
// backCamera.videoZoomFactor=1.0
|
||||
|
||||
// backCamera.unlockForConfiguration()
|
||||
|
||||
wideAngleCameraDeviceInput = try AVCaptureDeviceInput(device: backCamera)
|
||||
|
||||
guard let wideAngleCameraDeviceInput = wideAngleCameraDeviceInput,
|
||||
@ -1029,6 +1023,7 @@ extension CCSpatialShootController: AVCaptureFileOutputRecordingDelegate {
|
||||
}) { success, error in
|
||||
if success {
|
||||
print("保存成功")
|
||||
// self?.getAlbumFirstPhoto()
|
||||
} else if let error = error {
|
||||
print("保存失败")
|
||||
}
|
||||
@ -1156,7 +1151,7 @@ extension CCSpatialShootController: AVCaptureFileOutputRecordingDelegate {
|
||||
let creationRequest = PHAssetCreationRequest.forAsset()
|
||||
creationRequest.addResource(with: .photoProxy, fileURL: fileURL, options: nil)
|
||||
|
||||
}) { success, error in
|
||||
}) {[weak self] success, error in
|
||||
|
||||
DispatchQueue.main.async {
|
||||
SVProgressHUD.dismiss()
|
||||
@ -1169,9 +1164,10 @@ extension CCSpatialShootController: AVCaptureFileOutputRecordingDelegate {
|
||||
}
|
||||
} else {
|
||||
print("Photo saved to library successfully.")
|
||||
// DispatchQueue.main.async {
|
||||
DispatchQueue.main.async {
|
||||
// SVProgressHUD.showSuccess(withStatus: "空间图片成功保存到相册")
|
||||
// }
|
||||
self?.getAlbumFirstPhoto()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user