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