From 06ab0e319d83c83048853858cca74d045df72220 Mon Sep 17 00:00:00 2001 From: bluesea <307723040@qq.com> Date: Wed, 6 Mar 2024 16:54:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A9=BA=E9=97=B4=E8=A7=86=E9=A2=91=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E9=A1=B5=E9=9D=A2=EF=BC=9A=201=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=B9=B3=E8=A1=8C=E7=9C=BC=E9=80=89=E9=A1=B9=EF=BC=9B?= =?UTF-8?q?=202=EF=BC=8C=E4=BF=AE=E6=AD=A3=E5=88=87=E6=8D=A2=E7=BA=A2?= =?UTF-8?q?=E8=93=9D=E7=AB=8B=E4=BD=93=E3=80=81=E4=BA=A4=E5=8F=89=E7=9C=BC?= =?UTF-8?q?=E9=80=89=E9=A1=B9=E4=B9=8B=E5=90=8E=E6=97=A0=E6=B3=95=E5=86=8D?= =?UTF-8?q?=E6=AC=A1=E8=BD=AC=E7=A0=81=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E4=B8=BB=E8=A6=81=E6=98=AF=E4=BD=BF=E7=94=A8=E4=BA=86=E8=BD=AC?= =?UTF-8?q?=E7=A0=81=E5=90=8E=E7=9A=84=E9=9D=9E=E7=A9=BA=E9=97=B4=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E8=BF=9B=E8=A1=8C=E8=BD=AC=E7=A0=81=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=EF=BC=8C=E9=9C=80=E8=A6=81=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=8E=9F=E7=A9=BA=E9=97=B4=E8=A7=86=E9=A2=91=E8=BD=AC=E7=A0=81?= =?UTF-8?q?=E6=89=8D=E6=AD=A3=E7=A1=AE=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CCSpatialVideoDisplayController.swift | 63 ++++++++++++------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController.swift b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController.swift index 57d3f45..9a96e8c 100644 --- a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController.swift +++ b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController.swift @@ -45,7 +45,7 @@ class CCSpatialVideoDisplayController: BaseController { var imgData:Data? - //空间视频 交叉眼 红蓝立体 高斯模糊 + //空间视频 交叉眼 红蓝立体 平行眼 高斯模糊 var type = 0 var player:AVPlayer = AVPlayer() @@ -110,6 +110,7 @@ class CCSpatialVideoDisplayController: BaseController { }() var typeData:[(icon:String,title:String,isHiden:Bool)] = [(icon:"type_check",title:"单眼2D",isHiden:false), + (icon:"type_check",title:"平行眼",isHiden:false), (icon:"type_check",title:"红蓝立体",isHiden:false), (icon:"type_check",title:"交叉眼",isHiden:false)] @@ -283,6 +284,9 @@ class CCSpatialVideoDisplayController: BaseController { }else if self.selectedIndex == .crossedEyes { mTopCenterTypeButton.setTitle("交叉眼", for: UIControl.State.normal) } + else if self.selectedIndex == .parallelEyes { + mTopCenterTypeButton.setTitle("平行眼", for: UIControl.State.normal) + } mTopCenterTypeButton.setImage(UIImage.init(named: "type_button_arrow_down"), for: .normal) mTopCenterTypeButton.setTitleColor(UIColor.white, for: UIControl.State.normal) @@ -377,38 +381,44 @@ class CCSpatialVideoDisplayController: BaseController { func selectedSpatialType(selectedIndex:Int) { - if selectedIndex == 0 { - self.selectedIndex = .monocular2D - }else if selectedIndex == 1 { - self.selectedIndex = .redBlueSolid - }else if selectedIndex == 2 { - self.selectedIndex = .crossedEyes +// if selectedIndex == 0 { +// self.selectedIndex = .monocular2D +// }else if selectedIndex == 1 { +// self.selectedIndex = .redBlueSolid +// }else if selectedIndex == 2 { +// self.selectedIndex = .crossedEyes +// } + + self.selectedIndex = SpatialType(rawValue: selectedIndex) ?? .monocular2D + + player.pause() + NotificationCenter.default.removeObserver(self) + + //立体视频 + if(selectedIndex == 0){ + videoTempAsset = videoOriginalAsset + play() + } + else{ + outputVideoURL = URL.documentsDirectory.appending(path:"output11112.mp4") } - player.pause() - NotificationCenter.default.removeObserver(self) - - //立体视频 - if(selectedIndex == 0){ - videoTempAsset = videoOriginalAsset - play() - } - else{ - outputVideoURL = URL.documentsDirectory.appending(path:"output11112.mp4") - } - //红蓝立体 - if(selectedIndex == 1){ + if(self.selectedIndex == .redBlueSolid){ Task { convertor2.type = 3 - try await convertor2.convertVideo(asset: videoTempAsset!, outputFile: outputVideoURL! ) { [self] progress in + try await convertor2.convertVideo(asset: videoOriginalAsset!, outputFile: outputVideoURL! ) { [self] progress in print(progress) DispatchQueue.main.async { [weak self] in self?.progressView.setProgress(progress, animated: true) if(progress > 0.99){ self!.videoTempAsset = AVAsset(url: self!.outputVideoURL!) - self!.play() + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + // 要执行的任务 + self!.play() + } + } } @@ -417,11 +427,11 @@ class CCSpatialVideoDisplayController: BaseController { } //交叉眼 - if(selectedIndex == 2){ + if(self.selectedIndex == .crossedEyes){ Task { convertor2.type = 2 - try await convertor2.convertVideo(asset: videoTempAsset!, outputFile: outputVideoURL! ) { [self] progress in + try await convertor2.convertVideo(asset: videoOriginalAsset!, outputFile: outputVideoURL! ) { [self] progress in print(progress) DispatchQueue.main.async { [weak self] in self?.progressView.setProgress(progress, animated: true) @@ -435,6 +445,11 @@ class CCSpatialVideoDisplayController: BaseController { } } + //平行眼 + if(self.selectedIndex == .crossedEyes){ + + } +