From a898f957f9aadb50c70e2d76987d58494fb7b861 Mon Sep 17 00:00:00 2001 From: bluesea <307723040@qq.com> Date: Tue, 2 Apr 2024 16:13:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E9=99=A4=E6=97=A0=E6=95=88=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CCSpatialShootController.swift | 79 ++----------------- 1 file changed, 5 insertions(+), 74 deletions(-) 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()