优化拍摄视频的逻辑
This commit is contained in:
parent
8a6c0b365e
commit
b902c2bda6
Binary file not shown.
@ -387,8 +387,8 @@
|
|||||||
filePath = "SwiftProject/Project/Controller/RecordingVideo/CCSpatialShootController.swift"
|
filePath = "SwiftProject/Project/Controller/RecordingVideo/CCSpatialShootController.swift"
|
||||||
startingColumnNumber = "9223372036854775807"
|
startingColumnNumber = "9223372036854775807"
|
||||||
endingColumnNumber = "9223372036854775807"
|
endingColumnNumber = "9223372036854775807"
|
||||||
startingLineNumber = "1223"
|
startingLineNumber = "1237"
|
||||||
endingLineNumber = "1223"
|
endingLineNumber = "1237"
|
||||||
landmarkName = "compositeSpatialPhoto()"
|
landmarkName = "compositeSpatialPhoto()"
|
||||||
landmarkType = "7">
|
landmarkType = "7">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
@ -662,6 +662,21 @@
|
|||||||
endingLineNumber = "551"
|
endingLineNumber = "551"
|
||||||
offsetFromSymbolStart = "56">
|
offsetFromSymbolStart = "56">
|
||||||
</Location>
|
</Location>
|
||||||
|
<Location
|
||||||
|
uuid = "BB183D45-3193-4FC7-92DB-275D529A4AE6 - bc6a78627bfebc00"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
symbolName = "SwiftProject.CCSpatialVideoDisplayController.displayUpdate(caDisplayLink: __C.CADisplayLink) -> ()"
|
||||||
|
moduleName = "SwiftProject"
|
||||||
|
usesParentBreakpointCondition = "Yes"
|
||||||
|
urlString = "file:///Users/aaa/Documents/IOS%20Dev/VR/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController/CCSpatialVideoDisplayController.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "552"
|
||||||
|
endingLineNumber = "552"
|
||||||
|
offsetFromSymbolStart = "56">
|
||||||
|
</Location>
|
||||||
</Locations>
|
</Locations>
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</BreakpointProxy>
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class CCSpatialShootController: BaseController {
|
|||||||
var outputVideoURL: URL?
|
var outputVideoURL: URL?
|
||||||
let motionManager = CMMotionManager()
|
let motionManager = CMMotionManager()
|
||||||
var imgs:NSMutableArray = NSMutableArray() //存放广角、主摄照片数组
|
var imgs:NSMutableArray = NSMutableArray() //存放广角、主摄照片数组
|
||||||
|
let spatialVideoWriter = SpatialVideoWriter()
|
||||||
//================================
|
//================================
|
||||||
|
|
||||||
//当前相机模式
|
//当前相机模式
|
||||||
@ -729,6 +729,8 @@ class CCSpatialShootController: BaseController {
|
|||||||
let time = Date().timeIntervalSince1970
|
let time = Date().timeIntervalSince1970
|
||||||
let name1 = "wideAngleVideo" + String(time) + ".mov"
|
let name1 = "wideAngleVideo" + String(time) + ".mov"
|
||||||
let name2 = "ultraWideVideo" + String(time) + ".mov"
|
let name2 = "ultraWideVideo" + String(time) + ".mov"
|
||||||
|
leftEyeVideoURL = nil
|
||||||
|
rightEyeVideoURL = nil
|
||||||
let wideAngleCameraOutputURL = URL.documentsDirectory.appending(path:name1)
|
let wideAngleCameraOutputURL = URL.documentsDirectory.appending(path:name1)
|
||||||
let fultraWideCameraOutputURL = URL.documentsDirectory.appending(path:name2)
|
let fultraWideCameraOutputURL = URL.documentsDirectory.appending(path:name2)
|
||||||
|
|
||||||
@ -1044,6 +1046,7 @@ extension CCSpatialShootController: AVCaptureFileOutputRecordingDelegate {
|
|||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
SVProgressHUD.show(withStatus: NSLocalizedString("处理中...", comment: ""))
|
SVProgressHUD.show(withStatus: NSLocalizedString("处理中...", comment: ""))
|
||||||
|
print("....................................\n..................................")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1081,7 +1084,11 @@ extension CCSpatialShootController: AVCaptureFileOutputRecordingDelegate {
|
|||||||
print("ultra Wide video recorded: \(outputFileURL)")
|
print("ultra Wide video recorded: \(outputFileURL)")
|
||||||
rightEyeVideoURL = outputFileURL
|
rightEyeVideoURL = outputFileURL
|
||||||
}
|
}
|
||||||
createSpVideo()
|
if let leftEyeVideoURL,
|
||||||
|
let rightEyeVideoURL {
|
||||||
|
createSpVideo()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1090,25 +1097,32 @@ extension CCSpatialShootController: AVCaptureFileOutputRecordingDelegate {
|
|||||||
func createSpVideo(){
|
func createSpVideo(){
|
||||||
|
|
||||||
if(rightEyeVideoURL != nil && leftEyeVideoURL != nil){
|
if(rightEyeVideoURL != nil && leftEyeVideoURL != nil){
|
||||||
let spatialVideoWriter = SpatialVideoWriter()
|
|
||||||
Task {
|
Task {
|
||||||
spatialVideoWriter.writeSpatialVideo(leftEyeVideoURL: leftEyeVideoURL!, rightEyeVideoURL: rightEyeVideoURL!, outputVideoURL: outputVideoURL!) {[self] success, error in
|
spatialVideoWriter.writeSpatialVideo(leftEyeVideoURL: leftEyeVideoURL!, rightEyeVideoURL: rightEyeVideoURL!, outputVideoURL: outputVideoURL!) {[weak self] success, error in
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
SVProgressHUD.dismiss()
|
SVProgressHUD.dismiss()
|
||||||
|
print("SVProgressHUD.dismiss..2222.....")
|
||||||
}
|
}
|
||||||
if success {
|
if success {
|
||||||
print("空间视频生成成功")
|
print("空间视频生成成功")
|
||||||
saveVideoToLibrary(videoURL:outputVideoURL!)
|
if let ovrul = self?.outputVideoURL{
|
||||||
|
self?.saveVideoToLibrary(videoURL:ovrul)
|
||||||
|
}
|
||||||
|
|
||||||
// DispatchQueue.main.async {
|
// DispatchQueue.main.async {
|
||||||
// SVProgressHUD.showSuccess(withStatus: "空间视频成功保存到相册")
|
// SVProgressHUD.showSuccess(withStatus: "空间视频成功保存到相册")
|
||||||
// }
|
// }
|
||||||
} else if let error = error {
|
} else if let error = error {
|
||||||
|
print(".怎么失败了呢.....error\(error)")
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
SVProgressHUD.showInfo(withStatus: "\(NSLocalizedString("空间视频保存失败", comment: "")):\(error.localizedDescription)")
|
SVProgressHUD.showInfo(withStatus: "\(NSLocalizedString("空间视频保存失败", comment: "")):\(error.localizedDescription)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
print("not success......")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1252,6 +1266,7 @@ extension CCSpatialShootController: AVCaptureFileOutputRecordingDelegate {
|
|||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
SVProgressHUD.dismiss()
|
SVProgressHUD.dismiss()
|
||||||
|
print("SVProgressHUD.dismiss..1111.....")
|
||||||
}
|
}
|
||||||
|
|
||||||
if let error = error {
|
if let error = error {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user