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){ + + } +