浏览代码

合成时素材路径修改;

harry 3 年之前
父节点
当前提交
06c80860a2
共有 1 个文件被更改,包括 9 次插入9 次删除
  1. 9 9
      BFRecordScreenKit/Classes/BFRecordExport.swift

+ 9 - 9
BFRecordScreenKit/Classes/BFRecordExport.swift

@@ -80,11 +80,14 @@ public class BFRecordExport {
                         }
                     }
                     for srange in drangs {
-                        let range = srange.range
-                        let sticker = splitBaseMaterial(timelineIn: totalDur + subDur, model_in: range.start.seconds, duration: range.duration.seconds)
-                        sticker.volumeGain = 0
-                        itemModel.videoStickers.append(sticker)
-                        subDur += range.duration.seconds
+                        if let localPath = itemModel.localPath {
+                            let range = srange.range
+                            let sticker = splitBaseMaterial(timelineIn: totalDur + subDur, model_in: range.start.seconds, duration: range.duration.seconds)
+                            sticker.locationPath = localPath 
+                            sticker.volumeGain = 0
+                            itemModel.videoStickers.append(sticker)
+                            subDur += range.duration.seconds
+                        }
                     }
                     totalDur += subDur
                 }
@@ -131,9 +134,6 @@ public class BFRecordExport {
         bgMovieInfo.volumeGain = 1
         bgMovieInfo.aptDuration = bgMovieInfo.timelineOut
         bgMovieInfo.duration = bgMovieInfo.timelineOut
-        if let localPath = data?.first?.localPath {
-            bgMovieInfo.locationPath = localPath
-        }
         BFLog(1, message: "hhh- timIn:\(timelineIn), modIn:\(model_in), dur:\(duration)")
 
         return bgMovieInfo
@@ -206,7 +206,7 @@ public class BFRecordExport {
             var orgeBitRate = Int(outputSize.width * outputSize.height * 3)
 
             for stick in videoStickers {
-                if stick.type == StickerType.VIDEO.rawValue {
+                if stick.type == StickerType.VIDEO.rawValue, stick.locationPath.count > 0 {
                     let asset = AVURLAsset(url: URL(fileURLWithPath: stick.locationPath), options: avAssertOptions)
 
                     let cbr = asset.tracks(withMediaType: .video).first?.estimatedDataRate