|
@@ -57,6 +57,11 @@ class PQStuckPointPublicController: PQBaseViewController {
|
|
|
|
|
|
//add by ak 是否是再创作模式
|
|
|
var isReCreate:Bool = false
|
|
|
+
|
|
|
+ //最终使用的音频时长,用于拼接音乐使用
|
|
|
+ var finallyUserAudioTime:Float = 0.0
|
|
|
+ //拼接音乐的开始和结束位置
|
|
|
+ var clipAudioRange: CMTimeRange = CMTimeRange.zero
|
|
|
// 预览大小
|
|
|
private var preViewSize: CGSize {
|
|
|
switch aspectRatio {
|
|
@@ -632,7 +637,12 @@ extension PQStuckPointPublicController {
|
|
|
BFLog(message: "导出视频地址 \(outPutMP4URL)")
|
|
|
let inputAsset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + (audioMixModel?.localPath ?? "")), options: nil)
|
|
|
// 每次初始化的时候设置初始值 为 nIl
|
|
|
- exporter = PQCompositionExporter(asset: inputAsset, videoComposition: nil, audioMix: nil, filters: nil, stickers: mStickers, animationTool: nil, exportURL: outPutMP4URL)
|
|
|
+ var audioMix: AVMutableAudioMix?
|
|
|
+ var composition: AVMutableComposition?
|
|
|
+ if(finallyUserAudioTime != 0){
|
|
|
+ (audioMix, composition) = PQPlayerViewModel.setupAudioMix(originAsset: inputAsset, bgmData:nil, videoStickers: nil,originMusicDuration:finallyUserAudioTime,clipAudioRange: clipAudioRange)
|
|
|
+ }
|
|
|
+ exporter = PQCompositionExporter(asset: inputAsset, videoComposition: nil, audioMix: audioMix, filters: nil, stickers: mStickers, animationTool: nil, exportURL: outPutMP4URL)
|
|
|
|
|
|
var orgeBitRate = (editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) * (editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) * 3
|
|
|
|