|
@@ -742,13 +742,15 @@ extension PQStuckPointEditerController {
|
|
if synchroMarskView.superview == nil {
|
|
if synchroMarskView.superview == nil {
|
|
UIApplication.shared.keyWindow?.addSubview(synchroMarskView)
|
|
UIApplication.shared.keyWindow?.addSubview(synchroMarskView)
|
|
}
|
|
}
|
|
|
|
+ let dispatchGroup = DispatchGroup()
|
|
|
|
|
|
for photo in selectedPhotoData! {
|
|
for photo in selectedPhotoData! {
|
|
if photo.asset != nil, photo.asset?.mediaType == .video{
|
|
if photo.asset != nil, photo.asset?.mediaType == .video{
|
|
if !isHaveVideo {
|
|
if !isHaveVideo {
|
|
isHaveVideo = true
|
|
isHaveVideo = true
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ dispatchGroup.enter()
|
|
|
|
+
|
|
PQPHAssetVideoParaseUtil.parasToAVAsset(phAsset: photo.asset!) { avAsset, fileSize, _, _ in
|
|
PQPHAssetVideoParaseUtil.parasToAVAsset(phAsset: photo.asset!) { avAsset, fileSize, _, _ in
|
|
if avAsset is AVURLAsset {
|
|
if avAsset is AVURLAsset {
|
|
// 创建目录
|
|
// 创建目录
|
|
@@ -774,24 +776,19 @@ extension PQStuckPointEditerController {
|
|
}
|
|
}
|
|
|
|
|
|
do{
|
|
do{
|
|
- try FileManager.default.copyItem(atPath: fileName.replacingOccurrences(of: "file:///", with: ""), toPath: outFilePath)
|
|
|
|
- print("Success to copy file.")
|
|
|
|
|
|
+ try FileManager.default.copyItem(atPath: fileName.replacingOccurrences(of: "file:///", with: ""), toPath: outFilePath)
|
|
|
|
+ print("Success to copy file.")
|
|
}catch{
|
|
}catch{
|
|
- print("Failed to copy file.")
|
|
|
|
|
|
+ print("Failed to copy file.")
|
|
}
|
|
}
|
|
|
|
|
|
tempPhoto?.locationPath = outFilePath.replacingOccurrences(of: documensDirectory, with: "")
|
|
tempPhoto?.locationPath = outFilePath.replacingOccurrences(of: documensDirectory, with: "")
|
|
BFLog(message: "导出视频相册地址为 \(String(describing: tempPhoto?.locationPath))")
|
|
BFLog(message: "导出视频相册地址为 \(String(describing: tempPhoto?.locationPath))")
|
|
- }
|
|
|
|
-
|
|
|
|
- DispatchQueue.main.async {
|
|
|
|
- self.isExportVideosSuccess = true
|
|
|
|
- BFLog(message: "所有相册视频导出成功")
|
|
|
|
-
|
|
|
|
- self.dealWithDataSuccess()
|
|
|
|
|
|
|
|
|
|
+ dispatchGroup.leave()
|
|
|
|
+
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -799,6 +796,16 @@ extension PQStuckPointEditerController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ dispatchGroup.notify(queue: DispatchQueue.main) { [weak self] in
|
|
|
|
+ self?.isExportVideosSuccess = true
|
|
|
|
+ BFLog(message: "所有相册视频导出成功")
|
|
|
|
+ // 处理所有数据完成
|
|
|
|
+ if isHaveVideo {
|
|
|
|
+ self?.dealWithDataSuccess()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
//只有图片
|
|
//只有图片
|
|
if(!isHaveVideo){
|
|
if(!isHaveVideo){
|
|
self.isExportVideosSuccess = true
|
|
self.isExportVideosSuccess = true
|