diff --git a/SwiftProject/SwiftProject.xcodeproj/project.pbxproj b/SwiftProject/SwiftProject.xcodeproj/project.pbxproj index a00b875..379e3bc 100644 --- a/SwiftProject/SwiftProject.xcodeproj/project.pbxproj +++ b/SwiftProject/SwiftProject.xcodeproj/project.pbxproj @@ -9,7 +9,6 @@ /* Begin PBXBuildFile section */ 003624662BA3F0AB0080D014 /* ZZHImageExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 003624652BA3F0AB0080D014 /* ZZHImageExtension.swift */; }; 005580782B9F1525004B9567 /* ZZHHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 005580772B9F1525004B9567 /* ZZHHelper.swift */; }; - 00B946212B67AC9D00DA668F /* CCSpatialPlayController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00B946202B67AC9C00DA668F /* CCSpatialPlayController.swift */; }; 00B946232B67B26D00DA668F /* ddd_video.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 00B946222B67B26D00DA668F /* ddd_video.mp4 */; }; 00B946252B67B7DE00DA668F /* CCSpatialPlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00B946242B67B7DE00DA668F /* CCSpatialPlayView.swift */; }; 00D33BF42B998BF700604A44 /* SpatialImageConvertor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00D33BF32B998BF700604A44 /* SpatialImageConvertor.swift */; }; @@ -96,7 +95,6 @@ /* Begin PBXFileReference section */ 003624652BA3F0AB0080D014 /* ZZHImageExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZZHImageExtension.swift; sourceTree = ""; }; 005580772B9F1525004B9567 /* ZZHHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZZHHelper.swift; sourceTree = ""; }; - 00B946202B67AC9C00DA668F /* CCSpatialPlayController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CCSpatialPlayController.swift; sourceTree = ""; }; 00B946222B67B26D00DA668F /* ddd_video.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = ddd_video.mp4; sourceTree = ""; }; 00B946242B67B7DE00DA668F /* CCSpatialPlayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CCSpatialPlayView.swift; sourceTree = ""; }; 00D33BF32B998BF700604A44 /* SpatialImageConvertor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpatialImageConvertor.swift; sourceTree = ""; }; @@ -441,7 +439,6 @@ 00B946222B67B26D00DA668F /* ddd_video.mp4 */, AF2120F92B4EA5BD00400B7F /* CCHomeController.swift */, AF2120FB2B4EA5C800400B7F /* CCMineController.swift */, - 00B946202B67AC9C00DA668F /* CCSpatialPlayController.swift */, AF2120FD2B4EA5F100400B7F /* CCLoginController.swift */, AF2120FF2B4EA5FE00400B7F /* CCRegisterController.swift */, 04E1D3F02B68EDFE00743F2F /* CCWebController.swift */, @@ -658,7 +655,6 @@ AF2120F42B4EA43F00400B7F /* CCCollectionViewFlowLayout.swift in Sources */, AF2120C82B4E95DA00400B7F /* NSString+Add.swift in Sources */, 1E1EA2902B933C8200A5D5D2 /* VideoWriter.swift in Sources */, - 00B946212B67AC9D00DA668F /* CCSpatialPlayController.swift in Sources */, AF2120E62B4E9DE000400B7F /* CCTableSwitchView.swift in Sources */, 00D33BFA2B9AB21A00604A44 /* ZZHAVExtension.swift in Sources */, 1EFAF0B82B8AF1B8002A1773 /* CCSpaceAlbumPopView.swift in Sources */, @@ -845,7 +841,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 1.3; DEVELOPMENT_TEAM = 8DQD6BV6H9; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SwiftProject/Info.plist; @@ -858,21 +854,23 @@ INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.nkso.vptest; + PRODUCT_BUNDLE_IDENTIFIER = com.nsk.tdvideo; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = 1; }; name = Debug; }; @@ -884,7 +882,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 1.3; DEVELOPMENT_TEAM = 8DQD6BV6H9; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SwiftProject/Info.plist; @@ -897,21 +895,23 @@ INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.nkso.vptest; + PRODUCT_BUNDLE_IDENTIFIER = com.nsk.tdvideo; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = 1; }; name = Release; }; diff --git a/SwiftProject/SwiftProject/Project/Controller/CCSpatialPlayController.swift b/SwiftProject/SwiftProject/Project/Controller/CCSpatialPlayController.swift deleted file mode 100644 index 88d9f3c..0000000 --- a/SwiftProject/SwiftProject/Project/Controller/CCSpatialPlayController.swift +++ /dev/null @@ -1,162 +0,0 @@ -// -// CCSpatialPlayController.swift -// SwiftProject -// -// Created by aaa on 2024/1/29. -// - -//空间视频+空间转码 -import UIKit -import AVKit -import AVFoundation - - -class CCSpatialPlayController: BaseController { - - var mTopImgView:UIImageView? - var mAvPlayer:AVPlayerViewController? - - var mCenView:UIView? - var mCenLab1:UILabel? - var mCenLab2:UILabel? - var mCenBtn:UIButton? - - var mLabel:UILabel? - var mTabView:CCSpatialPlayView? - - var mBottomBtn:UIButton? - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - self.setNavgationBarColor(color: UIColor.clear) - } - - override func viewDidLoad() { - super.viewDidLoad() - self.view.backgroundColor = UIColor.black - self.navLine?.isHidden = true - self.setNavgaionTitle(string: "视频转码") - - //393*236 - mTopImgView = UIImageView(frame: CGRect(x: 0, y: 0, width: SCREEN_Width, height: SCREEN_Height * 236/393)) - view.addSubview(mTopImgView!) - mTopImgView?.image = UIImage.init(named: "BG_Top") - self.view.bringSubviewToFront(self.navtionBar!) - - - //345*200 - mAvPlayer = AVPlayerViewController() - mAvPlayer?.view.frame = CGRect(x: 24, y: Int(SafeAreaTop_Height) + 24, width: Int(SCREEN_Width) - 48, height: (Int(SCREEN_Width) - 48) * 200/345) - self.addChild(mAvPlayer!) - self.view.addSubview(mAvPlayer!.view) - mAvPlayer?.view.backgroundColor = UIColor.hexStringToColor(hexString: "#666666") - mAvPlayer!.view.clipsToBounds = true - mAvPlayer!.view.layer.cornerRadius = 8 - - let videoURL = Bundle.main.url(forResource: "ddd_video", withExtension: "mp4") - let player = AVPlayer(url: videoURL!) - mAvPlayer!.player = player - player.play() - - - mBottomBtn = UIButton.init(type: UIButton.ButtonType.custom) - self.view.addSubview(mBottomBtn!) - mBottomBtn!.backgroundColor = UIColor.hexStringToColor(hexString: "#5326D6") - mBottomBtn?.tag = 10 - mBottomBtn?.isSelected = false - mBottomBtn?.addTarget(self, action: #selector(navgationButtonClick2(sender:)), for: UIControl.Event.touchUpInside) - mBottomBtn?.frame = CGRect(x: 24, y: 10, width: SCREEN_Width - 48, height: 54) - mBottomBtn!.bottom = SCREEN_Height - SafeAreaBottom_Height - 30 - mBottomBtn!.clipsToBounds = true - mBottomBtn!.layer.cornerRadius = 8 - mBottomBtn!.setTitle("转码导出", for: UIControl.State.normal) - mBottomBtn!.setTitleColor(UIColor.white, for: UIControl.State.normal) - mBottomBtn!.titleLabel?.font = UIFont.systemFont(ofSize: 14) - - - mCenView = UIView() - self.view.addSubview(mCenView!) - mCenView?.frame = CGRect(x: 24, y: Int(mAvPlayer!.view.bottom) + 16, width: Int(SCREEN_Width) - 48, height: 70) - mCenView?.clipsToBounds = true - mCenView?.layer.cornerRadius = 12 - mCenView?.backgroundColor = UIColor.colorWithRGB(_r: 18, _g: 7, _b: 68) - - mCenLab1 = UILabel() - mCenLab1!.bounds = CGRect(x: 0, y: 0, width: 100, height: 0) - mCenLab1!.textColor = UIColor.hexStringToColor(hexString: "#ffffff") - mCenLab1!.font = UIFont.systemFont(ofSize: 14) - mCenView!.addSubview(mCenLab1!) - mCenLab1!.text = "20240121020131292.MOV" - mCenLab1!.sizeToFit() - if(mCenLab1!.width > mCenView!.width - 140){ - mCenLab1!.width = mCenView!.width - 140 - } - mCenLab1!.top = 12 - mCenLab1!.left = 16 - - - mCenLab2 = UILabel() - mCenLab2!.bounds = CGRect(x: 0, y: 0, width: 100, height: 0) - mCenLab2!.textColor = UIColor.hexStringToColor(hexString: "#67617A") - mCenLab2!.font = UIFont.systemFont(ofSize: 12) - mCenView!.addSubview(mCenLab2!) - mCenLab2!.text = "00:00:03 · 10.9 MB" - mCenLab2!.sizeToFit() - if(mCenLab2!.width > mCenView!.width - 140){ - mCenLab2!.width = mCenView!.width - 140 - } - mCenLab2!.top = 38 - mCenLab2!.left = 16 - - mCenBtn = UIButton.init(type: UIButton.ButtonType.custom) - mCenView!.addSubview(mCenBtn!) - mCenBtn!.backgroundColor = UIColor.hexStringToColor(hexString: "#5326D6") - mCenBtn?.tag = 11 - mCenBtn?.isSelected = false - mCenBtn?.addTarget(self, action: #selector(navgationButtonClick2(sender:)), for: UIControl.Event.touchUpInside) - mCenBtn?.frame = CGRect(x: 24, y: 10, width: 84, height: 36) - mCenBtn!.centerY = mCenView!.height * 0.5 - mCenBtn!.right = mCenView!.width - 16 - mCenBtn!.clipsToBounds = true - mCenBtn!.layer.cornerRadius = 10 - mCenBtn!.setTitle("MV-HEVC", for: UIControl.State.normal) - mCenBtn!.setTitleColor(UIColor.white, for: UIControl.State.normal) - mCenBtn!.titleLabel?.font = UIFont.systemFont(ofSize: 12) - - - mLabel = UILabel() - mLabel!.bounds = CGRect(x: 0, y: 0, width: 100, height: 0) - mLabel!.textColor = UIColor.hexStringToColor(hexString: "#6A696A") - mLabel!.font = UIFont.systemFont(ofSize: 14) - self.view.addSubview(mLabel!) - mLabel!.text = "格式" - mLabel!.sizeToFit() - mLabel!.top = mCenView!.bottom + 32 - mLabel!.left = 24 - - let maxHi = mBottomBtn!.top - mCenView!.bottom - 110 - var hi = 62.0*5 - if(hi > maxHi){hi = maxHi} - mTabView = CCSpatialPlayView.init(frame: CGRect(x: 24, y: mCenView!.bottom + 70, width: SCREEN_Width - 48, height: hi)) - self.view.addSubview(mTabView!) - mTabView!.backgroundColor = UIColor.hexStringToColor(hexString: "#1F1E20") - mTabView?.clipsToBounds = true - mTabView?.layer.cornerRadius = 12 - mTabView?.handle = {dic in - print(dic) - } - - } - - @objc public func navgationButtonClick2(sender:UIButton){ - - print("nihao") - - //侧边栏 - if(sender.tag == 11){ - - } - } - -} - diff --git a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialPhotoDisplayController.swift b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialPhotoDisplayController.swift index 240805e..318828b 100644 --- a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialPhotoDisplayController.swift +++ b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialPhotoDisplayController.swift @@ -13,7 +13,7 @@ import UIKit import ImageIO import CoreImage import Photos - +import SVProgressHUD enum VideoReaderError : Error { case invalidVideo @@ -341,6 +341,10 @@ class CCSpatialPhotoDisplayController: BaseController { self!.mImgView.image = lastImg } } + + if selectedIndex != 0 { + SVProgressHUD.showInfo(withStatus: "串流VR眼镜建设中") + } } //MARK: - 判断是不是空间照片 @@ -412,7 +416,21 @@ class CCSpatialPhotoDisplayController: BaseController { return buffer } - + func airPlayScreen(imageData:NSData){ + // 开始投屏 +// let airplaySession = UIScreen.main.startAirPlaySession(withCompletionHandler: { (success, error) in +// if success { +// print("投屏成功") +// } else { +// print("投屏失败:\(error)") +// } +// }) +// +// // 将图片发送到 AirPlay 会话 +// airplaySession.send(imageData, withType: .image) + + + } //将两张图片合成一张图片 func joinImages2( leftImage:CIImage, rightImage:CIImage) -> CIImage { diff --git a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialShootController.swift b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialShootController.swift index 995f667..2a3fd0c 100644 --- a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialShootController.swift +++ b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialShootController.swift @@ -641,6 +641,12 @@ class CCSpatialShootController: BaseController { //录像 @objc func shutterVideoButtonAction(_ sender: UIButton){ if !self.isRecording { + //判断设备方向,如果不是横屏left\right,则不允许录制 + if imageOrientation != .right || + imageOrientation != .left { + return + } + //录像中 print("录像中...") @@ -944,16 +950,25 @@ extension CCSpatialShootController: AVCaptureFileOutputRecordingDelegate { if let firstFrame = self.firstFrame(from: outputFileURL) { imgs.add(firstFrame) } + else { + print("wide Angle firstframe is lost....") + } } else if output == ultraWideCameraMovieOutput { print("ultra Wide photo recorded: \(outputFileURL)") if let firstFrame = self.firstFrame(from: outputFileURL) { imgs.add(firstFrame) } + else{ + print("ultra Wide firstFrame is lost....") + } } if(imgs.count == 2){ compositeSpatialPhoto() } + else { + print("images 少于2张....") + } }else if shootingMode == .CCShootingMode_Video { if output == wideAngleCameraMovieOutput { @@ -1049,15 +1064,10 @@ extension CCSpatialShootController: AVCaptureFileOutputRecordingDelegate { //合成空间图片 func compositeSpatialPhoto(){ - let img1:UIImage = imgs[0] as! UIImage let img2:UIImage = imgs[1] as! UIImage - - -// let imageSize1 = CGRect(x: 0, y: 0, width: img1.cgImage!.width, height: img1.cgImage!.height) -// let imageSize2 = CGRect(x: 0, y: 0, width: img2.cgImage!.width, height: img2.cgImage!.height) - - let url = URL.documentsDirectory.appending(path:"aaa12.HEIC") + + let url = URL.documentsDirectory.appending(path:".HEIC") let destination = CGImageDestinationCreateWithURL(url as CFURL, UTType.heic.identifier as CFString, 2, nil)! imageCGImagePropertyOrientation = .left let properties1 = [ diff --git a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/VRVideoTransformController.swift b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/VRVideoTransformController.swift index 4a92f0a..a25f0da 100644 --- a/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/VRVideoTransformController.swift +++ b/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/VRVideoTransformController.swift @@ -60,6 +60,16 @@ class VRVideoTransformController: BaseController { var mTabView:CCSpatialPlayView? var mBottomBtn:UIButton? + lazy var progressView:CCTransformProgressPopView? = { + let pv = CCTransformProgressPopView.init(frame: view.bounds) + pv.closeActionBlock = { + + } + pv.transformActionBlock = { + + } + return pv + }() //长宽 var videoWidth:Int = 1440 @@ -79,6 +89,14 @@ class VRVideoTransformController: BaseController { */ var selectedCodecType:AVVideoCodecType = AVVideoCodecType.h264 + //显示进度条 + func showProgress() { + if self.progressView?.superview == nil { + self.view .addSubview(self.progressView!) + } + //还未处理完毕... + self.progressView?.isHidden = false + } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) @@ -255,43 +273,6 @@ class VRVideoTransformController: BaseController { } //MARK: - 刷新界面 func according3DFormatShowList(format:Video3DFormat) { - - /* - case HSBS - case FSBS - case HOU - case FOU - */ - - //默认 - - - - - //赋值 - /* - let action1 = UIAlertAction(title: "原始" , style: .default) { (action:UIAlertAction) in - self.selectedPreset = .mvhevc1440x1440 - self.videoWidth = 1440 - self.videoHeight = 1440 - } - let action2 = UIAlertAction(title: "4K" , style: .default) { (action:UIAlertAction) in - self.selectedPreset = .hevc3840x2160 - self.videoWidth = 3840 - self.videoHeight = 2160 - } - let action3 = UIAlertAction(title: "1080p" , style: .default) { (action:UIAlertAction) in - self.selectedPreset = .hevc1920x1080 - self.videoWidth = 1920 - self.videoHeight = 1080 - } - let action4 = UIAlertAction(title: "720p" , style: .default) { (action:UIAlertAction) in - self.selectedPreset = .preset1280x720 - self.videoWidth = 1280 - self.videoHeight = 720 - } - - */ var presetText = "原始" switch self.selectedPreset { case .mvhevc1440x1440: diff --git a/SwiftProject/SwiftProject/Project/View/Album/CCSpaceAlbumFliterPopView/CCSpaceAlbumFliterPopView.swift b/SwiftProject/SwiftProject/Project/View/Album/CCSpaceAlbumFliterPopView/CCSpaceAlbumFliterPopView.swift index e6ce7f4..da5bf7c 100644 --- a/SwiftProject/SwiftProject/Project/View/Album/CCSpaceAlbumFliterPopView/CCSpaceAlbumFliterPopView.swift +++ b/SwiftProject/SwiftProject/Project/View/Album/CCSpaceAlbumFliterPopView/CCSpaceAlbumFliterPopView.swift @@ -123,7 +123,7 @@ class CCSpaceAlbumFliterPopView: UIView { //隐藏滑动条 collectionView.showsVerticalScrollIndicator = false collectionView.showsHorizontalScrollIndicator = false - collectionView.backgroundColor = UIColor.white + collectionView.backgroundColor = UIColor.black return collectionView }()