diff --git a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialShootController.swift b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialShootController.swift index de42c61..d7d5bb7 100644 --- a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialShootController.swift +++ b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialShootController.swift @@ -268,14 +268,7 @@ class CCSpatialShootController: BaseController { // view.backgroundColor = .white outputVideoURL = URL.documentsDirectory.appendingPathComponent("output.MOV") - - //====== - - // 开始生成设备方向通知 -// UIDevice.current.beginGeneratingDeviceOrientationNotifications() -// // 监听 UIDevice.orientationDidChangeNotification -// NotificationCenter.default.addObserver(self, selector: #selector(orientationDidChange), name: UIDevice.orientationDidChangeNotification, object: nil) - + configureSession() // 设置相机参数 setUI() @@ -302,7 +295,7 @@ class CCSpatialShootController: BaseController { //读取相册第一张照片 getAlbumFirstPhoto() - orientationDidChange() +// orientationDidChange() enableShutterBtn(false) } @@ -503,16 +496,7 @@ class CCSpatialShootController: BaseController { } - //MARK: - 显示提示 - func showTips() { -// self.view.addSubview(tipsLabel) -// self.view.bringSubviewToFront(tipsLabel) -// UIView.animate(withDuration: 3, delay: 2.0,options: .curveEaseInOut) { -// self.tipsLabel.alpha = 0 -// } completion: { finished in -// self.tipsLabel.isHidden = true -// } - } + func showHorizontalScreenTips() { self.horizontalImageView.isHidden = false @@ -616,20 +600,7 @@ class CCSpatialShootController: BaseController { //拍照 @objc func shutterPhotoButtonAction(){ - -// do { -// try wideAngleCameraDevice?.lockForConfiguration() -//// wideAngleCameraDevice?.ramp(toVideoZoomFactor: wideAngleCameraDevice!.videoZoomFactor+1.0, withRate: 2) -// wideAngleCameraDevice?.videoZoomFactor = wideAngleCameraDevice!.videoZoomFactor+1.0 -// wideAngleCameraDevice?.unlockForConfiguration() -// -// print("factor:\(wideAngleCameraDevice!.videoZoomFactor)") -// } -// catch { -// print("wide:err") -// } -// -// return + shutterPhotoButton.backgroundColor = .gray @@ -900,46 +871,7 @@ class CCSpatialShootController: BaseController { } - @objc fileprivate func orientationDidChange() { -// enableShutterBtn(false) -// switch UIDevice.current.orientation { -// case .unknown: -// print("未知") -// case .portrait: -// print("竖屏") -// imageCGImagePropertyOrientation = .up -// imageOrientation = .up -// -// autoStopRecordVideo() -// showHorizontalScreenTips() -// case .portraitUpsideDown: -// print("颠倒竖屏") -// autoStopRecordVideo() -// imageCGImagePropertyOrientation = .down -// imageOrientation = .down -// showHorizontalScreenTips() -// case .landscapeLeft: -// print("设备向左旋转横屏") -// imageCGImagePropertyOrientation = .left -// imageOrientation = .left -// hidenHorizontalScreenTips() -// enableShutterBtn(true) -// case .landscapeRight: -// print("设备向右旋转横屏") -// imageCGImagePropertyOrientation = .right -// imageOrientation = .right -// hidenHorizontalScreenTips() -// enableShutterBtn(true) -// case .faceUp: -// autoStopRecordVideo() -// print("屏幕朝上") -// case .faceDown: -// autoStopRecordVideo() -// print("屏幕朝下") -// default: -// break -// } - } + //当屏幕转向发生改变时,自动结束录像 func autoStopRecordVideo(){ @@ -953,7 +885,6 @@ class CCSpatialShootController: BaseController { deinit { // 移除通知 -// NotificationCenter.default.removeObserver(self, name: UIDevice.orientationDidChangeNotification, object: nil) // // 结束生成设备旋转方向通知 // UIDevice.current.endGeneratingDeviceOrientationNotifications()