瀏覽代碼

Merge branch 'master' of https://git.yishihui.com/iOS/BFFramework

wenweiwei 3 年之前
父節點
當前提交
602b057aa8

二進制
BFFramework/Assets/Stuckpoint/editCoverimageSelect_pq@2x.png


二進制
BFFramework/Assets/Stuckpoint/editCoverimageSelect_pq@3x.png


二進制
BFFramework/Assets/Stuckpoint/editCoverimageSelected_pq@2x.png


二進制
BFFramework/Assets/Stuckpoint/editCoverimageSelected_pq@3x.png


+ 11 - 4
BFFramework/Classes/BFModules/BFUtility/PQSingletoVideoPlayer.swift

@@ -126,7 +126,11 @@ public class PQSingletoVideoPlayer: NSObject {
             }
             playId = getUniqueId(desc: "playId")
             // 开始播放
-            startPlayr()
+            if let vc = bf_getCurrentViewController(), let playview = self.playControllerView{
+                if playview.isDescendant(of: vc.view){
+                    startPlayr()
+                }
+            }
         }
     }
 
@@ -222,9 +226,12 @@ public class PQSingletoVideoPlayer: NSObject {
         NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: nil) { _ in
 
             if self.autoResumePlayWhenEnterForeground, self.shouldResumePlayWhenEnterForeground {
-                self.shouldResumePlayWhenEnterForeground = false
-
-                self.resumePlayer()
+                if let vc = bf_getCurrentViewController(), let playview = self.playControllerView{
+                    if playview.isDescendant(of: vc.view){
+                        self.shouldResumePlayWhenEnterForeground = false
+                        self.resumePlayer()
+                    }
+                }
             }
         }
     }

+ 1 - 1
BFFramework/Classes/PQGPUImage/akfilters/PQGifFilter.swift

@@ -63,7 +63,7 @@ open class PQGifFilter: PQBaseFilter {
             // 不改变速度还是原速度
 
             if self?.mSticker?.materialDurationFit?.fitType == adapterMode.loopAuto.rawValue || self?.mSticker?.materialDurationFit?.fitType == adapterMode.staticFrame.rawValue {
-                self?.delayTime = self?.mDuration ?? 1 / Double(self?.mGifImages.count ?? 1)
+                self?.delayTime = (self?.mDuration ?? 1) / Double(self?.mGifImages.count ?? 1)
                 BFLog(message: "正常速度每一帧的时间:\(String(describing: self?.delayTime))")
             }
             sharedImageProcessingContext.runOperationSynchronously {

+ 3 - 2
BFFramework/Classes/PQGPUImage/akfilters/PQImageFilter.swift

@@ -126,7 +126,7 @@ open class PQImageFilter: PQBaseFilter {
 
         BFLog(2, message: " image filter 当前时间: \(currTime) \(newImage!.size)")
 
-//        if currTime >= mSticker!.timelineIn && currTime <= mSticker!.timelineOut {
+        if currTime >= mSticker!.timelineIn && currTime <= mSticker!.timelineOut {
         BFLog(2, message: " 显示图片当前时间: \(currTime) 开始时间:\(mSticker!.timelineIn) 结束时间:\(mSticker!.timelineOut)  \(String(describing: newImage?.size))")
         // 取纹理坐标
         var textureCoordinates = PQGPUImageTools.getTextureCoordinates(sticker: mSticker!, textureSize: newImage!.size, cannvasSize: inputSize)
@@ -169,6 +169,7 @@ open class PQImageFilter: PQBaseFilter {
                              vertexBufferObject: PQGPUImageTools.NXGenerateVBO(for: verticesPoint),
                              
                              inputTextures: [texturePropertiesimagetwo])
-        releaseIncomingFramebuffers()
+            releaseIncomingFramebuffers()
+        }
     }
 }

+ 5 - 0
BFFramework/Classes/PQGPUImage/akfilters/PQMovieFilter.swift

@@ -211,6 +211,10 @@ class PQMovieFilter: PQBaseFilter {
             startTimeStamp = currentTime
         }
         
+        if CMTimeGetSeconds(currentTime) >= stickerInfo!.timelineIn && CMTimeGetSeconds(currentTime) <= stickerInfo!.timelineOut {
+        
+     
+        
         //视频素材开始裁剪时间
         let stickerModelIn = CMTime(value: Int64((moveSticker?.model_in ?? 0)  * Float64(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE)
         
@@ -225,6 +229,7 @@ class PQMovieFilter: PQBaseFilter {
         readNextVideoFrame(showTimeStamp: showtimeStamp)
     
         framebufferIndex = framebufferIndex + 1
+        }
  
     }
 

+ 17 - 7
BFFramework/Classes/PQGPUImage/akfilters/PQMovieInput.swift

@@ -130,7 +130,10 @@ public class PQMovieInput: ImageSource {
 //    public  var seekQueue: DispatchQueue!
 
     // 是否为导出模式
-    public   var mIsExport: Bool = false
+    public var mIsExport: Bool = false
+    
+    //是否使用AVPlayer播放音乐
+    public var isUsedAVPlayer:Bool = false
     
     //打印开始时间
     var debugStartTime:CFTimeInterval?
@@ -170,10 +173,10 @@ public class PQMovieInput: ImageSource {
 
         if #available(iOS 10, *){
             displayLink?.preferredFramesPerSecond = 30
-//            seekQueue = DispatchQueue(label: "PQ.MovieInput.seeking", qos: .userInteractive, attributes: .initiallyInactive, autoreleaseFrequency: .never, target: nil)
+ 
         }else{
             displayLink?.frameInterval = 2
-//            seekQueue = DispatchQueue(label: "PQ.MovieInput.seeking", qos: .userInteractive, attributes: [], autoreleaseFrequency: .inherit, target: nil)
+ 
         }
         // 加入循环 要使用 common 不要让级别高的卡住回调事件
         displayLink?.add(to: RunLoop.main, forMode: RunLoop.Mode.common)
@@ -237,7 +240,14 @@ public class PQMovieInput: ImageSource {
             let duration = CMTimeGetSeconds(playeTimeRange.end)
             
             if !mIsExport {
-                self.currentTime = CMTimeMakeWithSeconds(CFAbsoluteTimeGetCurrent() - self.beginTime +  CMTimeGetSeconds(startTime ?? CMTime.zero), preferredTimescale: BASE_FILTER_TIMESCALE)
+        
+               var midTime = CFAbsoluteTimeGetCurrent() - self.beginTime
+                if(midTime < 0.0001){
+                    midTime = 0
+                }
+                BFLog(message: "CFAbsoluteTimeGetCurrent()\(CFAbsoluteTimeGetCurrent()) - self.beginTime  is:::::\(self.beginTime) 差值 \(midTime)")
+              
+                self.currentTime = CMTimeMakeWithSeconds(midTime +  CMTimeGetSeconds(startTime ?? CMTime.zero), preferredTimescale: BASE_FILTER_TIMESCALE)
             }else {
                 self.currentTime = CMTimeMakeWithSeconds(self.beginTime +  CMTimeGetSeconds(startTime ?? CMTime.zero), preferredTimescale: BASE_FILTER_TIMESCALE)
                 self.beginTime = self.beginTime + 1 / 30
@@ -330,7 +340,7 @@ public class PQMovieInput: ImageSource {
         mIsExport = isExport
         do {
             try NSObject.catchException { [self] in
-                if(mIsExport){
+                if(!isUsedAVPlayer){
                     guard self.assetReader.startReading() else {
                         BFLog(2, message: "ERROR: Unable to start reading: \(String(describing: self.assetReader.error))")
                         return
@@ -502,8 +512,8 @@ public class PQMovieInput: ImageSource {
 
     func readNextAudioSample(with assetReader: AVAssetReader, from audioTrackOutput: AVAssetReaderOutput) {
         
-        if(!mIsExport){
-            BFLog(2, message: "不是导出模式")
+        if(isUsedAVPlayer){
+            BFLog(2, message: "使用的 avplayer 播放模式")
             return
         }
        

+ 13 - 4
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

@@ -119,6 +119,8 @@ class PQStuckPointEditerController: PQBaseViewController {
     var stuckPointsTemp: Array = Array<Float>.init()
     var stuckPointsTempInt64: Array = Array<Int64>.init()
 
+    //是否点击了下一步去合成
+    var isClickNextBtn:Bool = false
 
     // 下一步
     lazy var nextBtn: UIButton = {
@@ -733,6 +735,12 @@ class PQStuckPointEditerController: PQBaseViewController {
 
         PQNotification.addObserver(self, selector: #selector(enterBackground), name: UIApplication.didEnterBackgroundNotification, object: nil)
         PQNotification.addObserver(self, selector: #selector(willEnterForeground), name: UIApplication.willEnterForegroundNotification, object: nil)
+        
+        //从分享返回后从重初始化播放器
+        if(isClickNextBtn){
+            isClickNextBtn = false
+            settingPlayerView()
+        }
     }
     
     override func viewWillDisappear(_ animated: Bool) {
@@ -921,6 +929,8 @@ class PQStuckPointEditerController: PQBaseViewController {
 
     @objc func nextBtnClick(sender _: UIButton) {
         BFLog(message: "去发布")
+     
+        isClickNextBtn = true
         playerView.pause()
         // 使用深 copy
         let json = projectModel.toJSONString(prettyPrint: false)
@@ -1090,7 +1100,7 @@ class PQStuckPointEditerController: PQBaseViewController {
             return
         }
 
-        let maxValue = max(videoSize.width, videoSize.height ?? 0)
+        let maxValue = max(videoSize.width, videoSize.height)
 
         if maxValue > 1920 {
             let maxRation = 1920 / maxValue
@@ -1140,7 +1150,7 @@ class PQStuckPointEditerController: PQBaseViewController {
                 // 这里的测试这个音乐播放有问题
                 //        self.playerView.updateAsset(URL(fileURLWithPath: "63930549652d74e477141e3b79c8d29a9ef8af81625053214516.mp3", relativeTo:Bundle.main.resourceURL!), videoComposition: nil, audioMixModel: nil)
 
-                self.playerView.updateAsset(URL(fileURLWithPath: documensDirectory + audioPath), videoComposition: nil, audioMixModel: nil, originMusicDuration: self.finallyUserAudioTime, clipAudioRange: self.getClipAudioRange())
+                self.playerView.updateAsset(URL(fileURLWithPath: documensDirectory + audioPath), videoComposition: nil, audioMixModel: nil, originMusicDuration: self.finallyUserAudioTime, clipAudioRange: self.getClipAudioRange(),isUsedAVPlayer: true)
 
                 // 4, 设置播放器的输出画布大小
                 self.playerView.movie?.mShowVidoSize = CGSize(width: CGFloat(self.projectModel.sData?.videoMetaData?.videoWidth ?? 0), height: CGFloat(self.projectModel.sData?.videoMetaData?.videoHeight ?? 0))
@@ -1598,9 +1608,7 @@ extension PQStuckPointEditerController {
                     i = i + 1
                     clipNum = clipNum + 1
                 }
-
                 // 拼接要使用的卡点信息
-
                 clipPoint(clipNum: clipNum, oldPoints: stuckPointsTemp)
             }
 
@@ -1846,6 +1854,7 @@ extension PQStuckPointEditerController {
                     self?.dealWithDataSuccess(resetSelectIndex: resetSelectIndex)
                 } else {
                     self?.synchroMarskView.removeMarskView()
+                    cShowHUB(superView: nil, msg: "音乐信息加载失败,请重新选择音乐")
 //                    PQUploadRemindView.showUploadRemindView(title: nil, attributedTitle: NSAttributedString(string: "加载音乐失败,请重新选择音乐"), summary: "", confirmTitle: nil) { [weak self] _, _ in
 //                        self?.navigationController?.popViewController(animated: true)
 //                    }

+ 23 - 9
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointPublicController.swift

@@ -14,6 +14,10 @@ import Kingfisher
 import BFCommonKit
 import Alamofire
 
+
+//mdf by ak 按 UI图 下方操作区的高度是固定的, 其它区高度和设备自适应
+public let bottomOprationBgViewHeight:CGFloat = 322.0
+
 class PQStuckPointPublicController: PQBaseViewController {
     private var isShared: Bool = false // 是否在分享
     private var isExportSuccess: Bool = false // 是否导出完成
@@ -36,10 +40,11 @@ class PQStuckPointPublicController: PQBaseViewController {
     var selectedDataCount: Int = 0
     // 选择的图片总数-统计使用
     var selectedImageDataCount: Int = 0
+
     // 最大的宽度
     private var maxWidth: CGFloat = cScreenWidth
     // 最大的高度
-    private var maxHeight: CGFloat = cScreenHeigth > 568 ? 385 : 385*cScreenHeigth/818
+    private var maxHeight: CGFloat = cScreenHeigth - bottomOprationBgViewHeight - cDevice_iPhoneNavBarAndStatusBarHei
     // 开始导出的时间
     private let startExportDate: Float64 = Date().timeIntervalSince1970
     // 导出结束的时间
@@ -84,6 +89,8 @@ class PQStuckPointPublicController: PQBaseViewController {
     private var endMovieLocalURL: URL?
     // 保存相册的合成视频地址 水印+片尾 MP4 地址
     private var saveMovieLocalURL: URL?
+    
+    private var isSaveingLocalVideo = false
   
     //----------------------------
 
@@ -322,7 +329,8 @@ class PQStuckPointPublicController: PQBaseViewController {
         let titleLabel = UILabel()
         titleLabel.numberOfLines = 2
         titleLabel.isUserInteractionEnabled = true
-        titleLabel.textColor = UIColor.hexColor(hexadecimal: "#ABABAB")
+
+        titleLabel.textColor = PQBFConfig.shared.styleTitleColor
         titleLabel.textAlignment = .left
         titleLabel.font = UIFont.systemFont(ofSize: 17)
         let ges = UITapGestureRecognizer(target: self, action: #selector(titleLabelClick))
@@ -345,7 +353,7 @@ class PQStuckPointPublicController: PQBaseViewController {
                 inputText = inputText.replacingOccurrences(of: " ", with: "")
 
                 if inputText.count > 0 {
-                    self?.setTitleText(text: title ?? "", textColor: .black)
+                    self?.setTitleText(text: title ?? "", textColor: PQBFConfig.shared.styleTitleColor)
                     // 更新数据
                     self?.videoData?.title = title
                     self?.updateCoverImagegOrTitle()
@@ -413,7 +421,7 @@ class PQStuckPointPublicController: PQBaseViewController {
 
     // 除了播放器以外的 下半部分操作区
     lazy var bottomOprationBgView: UIView = {
-        let bottomOprationBgView = UIView(frame: CGRect(x: 0, y: cDevice_iPhoneNavBarAndStatusBarHei + maxHeight, width: cScreenWidth, height: view.frame.height - cDevice_iPhoneNavBarAndStatusBarHei - maxHeight))
+        let bottomOprationBgView = UIView(frame: CGRect(x: 0, y: cDevice_iPhoneNavBarAndStatusBarHei + maxHeight, width: cScreenWidth, height: bottomOprationBgViewHeight))
         bottomOprationBgView.backgroundColor = .clear
         bottomOprationBgView.isHidden = true
         return bottomOprationBgView
@@ -950,7 +958,7 @@ extension PQStuckPointPublicController {
             /// fp2-1-2 - 保存视频到相册
             saveStuckPointVideo()
         } else {
-//            cShowHUB(superView: nil, msg: "您尚未打开相册权限,请到设置页打开相册权限")
+            cShowHUB(superView: nil, msg: "您尚未打开相册权限,请到设置页打开相册权限")
         }
     }
 
@@ -961,6 +969,7 @@ extension PQStuckPointPublicController {
         
         if(saveMovieLocalURL == nil){
             BFLog(message: "保存相册的视频导出地址无效!!!")
+            cShowHUB(superView: nil, msg: "保存相册的视频导出地址无效")
             saveVideoTipsLabel.text = "视频保存失败"
             saveRetryBtn.isHidden = false
             saveVideoTipsBgView.isHidden = false
@@ -973,8 +982,10 @@ extension PQStuckPointPublicController {
         if authStatus == .authorized {
             let photoLibrary = PHPhotoLibrary.shared()
             photoLibrary.performChanges({ [weak self] in
+                self?.isSaveingLocalVideo = true
                 PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: (self?.saveMovieLocalURL)!)
             }) { [weak self] isFinished, _ in
+                self?.isSaveingLocalVideo = false
                 DispatchQueue.main.async { [weak self] in
                     if self?.view != nil {
                         if isFinished {
@@ -997,7 +1008,7 @@ extension PQStuckPointPublicController {
                 }
             }
         } else {
-//                cShowHUB(superView: nil, msg: "您尚未打开相册权限,请到设置页打开相册权限")
+            cShowHUB(superView: nil, msg: "您尚未打开相册权限,请到设置页打开相册权限")
         }
     }
 
@@ -1315,9 +1326,8 @@ extension PQStuckPointPublicController {
         } else {
             bottomOprationBgView.isHidden = false
             //add by ak 发布成功后如果带片尾的视频还没有生成成功时,出提示
-            saveVideoTipsBgView.isHidden = false
             self.saveRetryBtn.isHidden = true
-            if(saveMovieLocalURL == nil){
+            if(saveMovieLocalURL == nil && self.isSaveingLocalVideo){
                 saveVideoTipsLabel.text = "视频保存中..."
             }else{
                 self.saveVideoTipsLabel.text = "视频已保存到相册"
@@ -1325,6 +1335,9 @@ extension PQStuckPointPublicController {
                     self?.saveVideoTipsBgView.isHidden = true
                 }
             }
+            if self.isSaveingLocalVideo{
+                saveVideoTipsBgView.isHidden = false
+            }
             
         }
     }
@@ -1438,9 +1451,10 @@ extension PQStuckPointPublicController {
             // 发送通知
             postNotification(name: cFinishedPublishedNotiKey)
         case 97:
+            // 视频保存重试
             saveRetryBtn.isHidden = true
             saveVideoTipsLabel.text = "视频保存中..."
-            self.saveStuckPointVideo()
+            saveStuckPointVideo()
         default:
             break
         }

+ 4 - 0
BFFramework/Classes/Stuckpoint/View/PQCustomSpeedSettingView.swift

@@ -256,7 +256,11 @@ class PQCustomSpeedSettingView: UIView {
         if selectSpeedCallBack != nil {
             if(viewType == 1){
                 selectSpeedCallBack!(fastSlider.value.decimalNumber(), slowSlider.value.decimalNumber(), viewType,false)
+            }else if(viewType == 2){
+                //跳跃模式时 支持小数值
+                selectSpeedCallBack!(jumpSpeedSlider.value, 0, viewType,false)
             }else{
+                //循环比时都是整数
                 selectSpeedCallBack!(jumpSpeedSlider.value.decimalNumber(0), 0, viewType,false)
             }
         

+ 11 - 8
BFFramework/Classes/Stuckpoint/View/PQEditPublicCoverImageView.swift

@@ -23,7 +23,7 @@ class PQEditPublicCoverImageView: UIView {
     lazy var backView: UIView = {
         let backView = UIView()
         backView.addCorner(corner: 1.5)
-        backView.backgroundColor = .white
+        backView.backgroundColor = PQBFConfig.shared.otherTintColor
         return backView
     }()
 
@@ -36,11 +36,13 @@ class PQEditPublicCoverImageView: UIView {
     // 确定按钮
     lazy var compliteBtn: UIButton = {
         let compliteBtn = UIButton(type: .custom)
-        compliteBtn.frame = CGRect(x: 0, y: 0, width: 70, height: 70)
-        compliteBtn.setImage(UIImage.moduleImage(named: "editCoverimageOk", moduleName: "BFFramework",isAssets: false), for: .normal)
-        compliteBtn.backgroundColor = PQBFConfig.shared.styleBackGroundColor
+        compliteBtn.backgroundColor =  UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
+        compliteBtn.setTitle("确定", for: .normal)
+        compliteBtn.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .medium)
+        compliteBtn.setTitleColor(UIColor.hexColor(hexadecimal: "#FFFFFF"), for: .normal)
         compliteBtn.adjustsImageWhenHighlighted = false
         compliteBtn.tag = 2
+        compliteBtn.addCorner(corner: 11)
         compliteBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
         return compliteBtn
     }()
@@ -48,10 +50,10 @@ class PQEditPublicCoverImageView: UIView {
     // 从相册选择
     lazy var selectPhotoBtn: UIButton = {
         let selectPhotoBtn = UIButton(type: .custom)
-        selectPhotoBtn.frame = CGRect(x: 0, y: 0, width: 70, height: 70)
-        selectPhotoBtn.setImage(UIImage.moduleImage(named: "editCoverimageSelect", moduleName: "BFFramework",isAssets: false), for: .normal)
+       
+        selectPhotoBtn.setImage(UIImage.moduleImage(named:  PQBFConfig.shared.editCoverimageSelectImage, moduleName: "BFFramework",isAssets: false), for: .normal)
         selectPhotoBtn.adjustsImageWhenHighlighted = false
-        selectPhotoBtn.backgroundColor = PQBFConfig.shared.styleBackGroundColor
+        selectPhotoBtn.addCorner(corner: 11)
         selectPhotoBtn.tag = 1
         selectPhotoBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
         return selectPhotoBtn
@@ -89,7 +91,8 @@ class PQEditPublicCoverImageView: UIView {
             coverImageBtn.addTarget(self, action: #selector(coverImageBtnClick(sender:)), for: .touchUpInside)
             //选中后的角标
             let iconView = UIImageView.init(frame: CGRect(x: frame.size.width  - 22.0 - 6, y: 6, width: 22, height: 22))
-            iconView.image = UIImage.moduleImage(named: "editCoverimageSelected", moduleName: "BFFramework",isAssets: false)
+            iconView.image = UIImage.moduleImage(named:  PQBFConfig.shared.editCoverimageSelectedImage, moduleName: "BFFramework",isAssets: false)
+           
           
             iconView.tag = 1000
             if(i == 0){

+ 19 - 2
BFFramework/Classes/Stuckpoint/ViewModel/PQGPUImagePlayerView.swift

@@ -149,6 +149,9 @@ public class PQGPUImagePlayerView: UIView {
     
     //是否显示高斯
     public  var showGaussianBlur:Bool = false
+    
+    //是否使用AVPlayer播放音乐
+    public var isUsedAVPlayer:Bool = false
 
     // 渲染区view
     private lazy var renderView: RenderView = {
@@ -158,6 +161,9 @@ public class PQGPUImagePlayerView: UIView {
         view.delegate = self
         let tap = UITapGestureRecognizer(target: self, action: #selector(RenderViewOnclick))
         view.addGestureRecognizer(tap)
+ 
+        view.backgroundRenderColor =  Color.init(red: Float(PQBFConfig.shared.styleBackGroundColor.rgbaf[0]), green: Float(PQBFConfig.shared.styleBackGroundColor.rgbaf[1]), blue: Float(PQBFConfig.shared.styleBackGroundColor.rgbaf[2]))
+
         return view
     }()
 
@@ -225,6 +231,7 @@ public class PQGPUImagePlayerView: UIView {
     override public init(frame: CGRect) {
         super.init(frame: frame)
 
+        
         addSubview(renderView)
         addSubview(progressLab)
         addSubview(playMaskView)
@@ -357,7 +364,8 @@ public class PQGPUImagePlayerView: UIView {
     }
 
     /// XXXX 这里的 URL 使用的是全路径 ,如果不是全的会 crash ,方便复用 (不用处理业务的文件放在哪里)
-    public func updateAsset(_ url: URL, videoComposition: AVVideoComposition? = nil, audioMixModel: PQVoiceModel? = nil, videoStickers: [PQEditVisionTrackMaterialsModel]? = nil,originMusicDuration:Float = 0,lastPoint:Float = 0,clipAudioRange: CMTimeRange = CMTimeRange.zero ) {
+    public func updateAsset(_ url: URL, videoComposition: AVVideoComposition? = nil, audioMixModel: PQVoiceModel? = nil, videoStickers: [PQEditVisionTrackMaterialsModel]? = nil,originMusicDuration:Float = 0,lastPoint:Float = 0,clipAudioRange: CMTimeRange = CMTimeRange.zero ,isUsedAVPlayer:Bool = false) {
+        self.isUsedAVPlayer = isUsedAVPlayer
         // 每次初始化的时候设置初始值 为 nIl
         var audioMix: AVMutableAudioMix?
         var composition: AVMutableComposition?
@@ -392,7 +400,14 @@ public class PQGPUImagePlayerView: UIView {
                 BFLog(2, message: "composition 方式初始化")
                 movie = try PQMovieInput(asset: composition!, videoComposition: videoComposition, audioMix: audioMix, playAtActualSpeed: true, loop: isLoop, audioSettings: audioSettings)
 //                movie?.exportAudioUrl = url // clipAudioRange
-                movie?.configAVPlayer(assetUrl: url, ranges: [clipAudioRange])
+                var ranges = Array<CMTimeRange>()
+                if CMTimeGetSeconds(clipAudioRange.duration) ==  0 {
+                    let range = CMTimeRange(start: CMTime.zero, duration: asset.duration)
+                    ranges.append(range)
+                }else{
+                    ranges.append(clipAudioRange)
+                }
+                movie?.configAVPlayer(assetUrl: url, ranges: ranges)
             } else {
                 movie = try PQMovieInput(url: url, playAtActualSpeed: true, loop: isLoop, audioSettings: audioSettings)
 
@@ -406,6 +421,8 @@ public class PQGPUImagePlayerView: UIView {
 
             movie!.runBenchmark = false
             movie!.synchronizedEncodingDebug = false
+            
+            movie!.isUsedAVPlayer = isUsedAVPlayer
 
         } catch {
             status = .error

+ 15 - 10
BFFramework/Classes/selectImage/PQUploadController.swift

@@ -135,10 +135,10 @@ class PQUploadController: PQBaseViewController {
         let backBtn = UIButton(type: .custom)
         backBtn.frame = CGRect(x: 0, y: cDevice_iPhoneStatusBarHei, width: cDefaultMargin * 4, height: cDefaultMargin * 4)
         backBtn.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: -5, right: 0)
-        backBtn.backgroundColor = .yellow
        
-        backBtn.setImage(UIImage.moduleImage(named: "icon_blanc_back", moduleName: "BFFramework",isAssets: false), for: .normal)
+        backBtn.setImage(UIImage.moduleImage(named: "icon_blanc_back", moduleName: "BFFramework",isAssets: false)?.withRenderingMode(.alwaysTemplate), for: .normal)
         backBtn.addTarget(self, action: #selector(backBtnClick), for: .touchUpInside)
+        backBtn.imageView?.tintColor = PQBFConfig.shared.styleTitleColor
         return backBtn
     }()
 
@@ -206,7 +206,7 @@ class PQUploadController: PQBaseViewController {
         } else {
             automaticallyAdjustsScrollViewInsets = false
         }
-        categoryCollectionView.backgroundColor = .white
+        categoryCollectionView.backgroundColor = PQBFConfig.shared.editCoverimageSelectedbackgroundColor
         return categoryCollectionView
     }()
 
@@ -247,21 +247,23 @@ class PQUploadController: PQBaseViewController {
         let selecteBtn = UIButton(frame: CGRect(x: deleteBtn.frame.maxX + cDefaultMargin, y: 0, width: cScreenWidth - nextBtn.frame.width - deleteBtn.frame.maxX - cDefaultMargin * 5, height: cDevice_iPhoneTabBarHei))
         selecteBtn.titleLabel?.lineBreakMode = .byTruncatingTail
         selecteBtn.setTitle("全部", for: .normal)
-        
-        selecteBtn.setImage(UIImage.moduleImage(named: "icon_uploadVideo_more", moduleName: "BFFramework",isAssets: false), for: .normal)
-        selecteBtn.setTitleColor(UIColor.black, for: .normal)
+         
+        selecteBtn.setImage(UIImage.moduleImage(named: "icon_uploadVideo_more", moduleName: "BFFramework",isAssets: false)?.withRenderingMode(.alwaysTemplate), for: .normal)
+        selecteBtn.setTitleColor( PQBFConfig.shared.styleTitleColor, for: .normal)
         selecteBtn.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .medium)
         selecteBtn.tag = 2
         selecteBtn.imagePosition(at: PQButtonImageEdgeInsetsStyle.right, space: cDefaultMargin / 2)
+        selecteBtn.imageView?.tintColor = PQBFConfig.shared.styleTitleColor
         selecteBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
         return selecteBtn
     }()
 
     lazy var deleteBtn: UIButton = {
         let deleteBtn = UIButton(frame: CGRect(x: cDefaultMargin, y: 0, width: cDefaultMargin * 4, height: cDevice_iPhoneTabBarHei))
-        deleteBtn.setImage(UIImage.moduleImage(named: "icon_blanc_back", moduleName: "BFFramework",isAssets: false), for: .normal)
+        deleteBtn.setImage(UIImage.moduleImage(named: "icon_blanc_back", moduleName: "BFFramework",isAssets: false)?.withRenderingMode(.alwaysTemplate), for: .normal)
         deleteBtn.tag = 1
         deleteBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
+        deleteBtn.imageView?.tintColor = PQBFConfig.shared.styleTitleColor
         return deleteBtn
     }()
 
@@ -290,11 +292,14 @@ class PQUploadController: PQBaseViewController {
 
     override func viewDidLoad() {
         super.viewDidLoad()
-        view.backgroundColor = .white
-        navHeadImageView?.backgroundColor = .white
-        lineView?.backgroundColor = .white
+     
+        view.backgroundColor =  PQBFConfig.shared.editCoverimageSelectedbackgroundColor
+        navHeadImageView?.backgroundColor =  PQBFConfig.shared.editCoverimageSelectedbackgroundColor
+        lineView?.backgroundColor =  PQBFConfig.shared.editCoverimageSelectedbackgroundColor
         addSubViews()
+        bottomView.backgroundColor = PQBFConfig.shared.editCoverimageSelectedbackgroundColor
         loadLocalData()
+ 
     }
 
     deinit {