Browse Source

Merge branch 'master' into module

* master:
  视频加工:音频无声问题
  适配创作工具模式进退场时间
  适配创作工具的 进场和退场时间
  设置不同背景色
  视频保存提示异常修复
  播放器自动放时的判断
  iphone6 ui 适配
  音乐下载失败给提示
  ui 多风格测试

# Conflicts:
#	BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift
#	BFFramework/Classes/Stuckpoint/Controller/PQStuckPointPublicController.swift
harry 3 years ago
parent
commit
d97b89c178

BIN
BFFramework/Assets/Stuckpoint/editCoverimageSelect_pq@2x.png


BIN
BFFramework/Assets/Stuckpoint/editCoverimageSelect_pq@3x.png


BIN
BFFramework/Assets/Stuckpoint/editCoverimageSelected_pq@2x.png


BIN
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()
+                    }
+                }
             }
         }
     }

+ 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
+        }
  
     }
 

+ 2 - 0
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

@@ -1847,6 +1847,8 @@ extension PQStuckPointEditerController {
                 } else {
                     self?.synchroMarskView.removeMarskView()
 //                    BFUploadRemindView.showUploadRemindView(title: nil, attributedTitle: NSAttributedString(string: "加载音乐失败,请重新选择音乐"), summary: "", confirmTitle: nil) { [weak self] _, _ in
+                    cShowHUB(superView: nil, msg: "音乐信息加载失败,请重新选择音乐")
+
 //                        self?.navigationController?.popViewController(animated: true)
 //                    }
                 }

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

@@ -14,6 +14,9 @@ import Kingfisher
 import BFUIKit
 import Alamofire
 
+
+//mdf by ak 按 UI图 下方操作区的高度是固定的, 其它区高度和设备自适应
+public let bottomOprationBgViewHeight:CGFloat = 322.0
 class PQStuckPointPublicController: BFBaseViewController {
     private var isShared: Bool = false // 是否在分享
     private var isExportSuccess: Bool = false // 是否导出完成
@@ -36,10 +39,11 @@ class PQStuckPointPublicController: BFBaseViewController {
     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 +88,8 @@ class PQStuckPointPublicController: BFBaseViewController {
     private var endMovieLocalURL: URL?
     // 保存相册的合成视频地址 水印+片尾 MP4 地址
     private var saveMovieLocalURL: URL?
+    
+    private var isSaveingLocalVideo = false
   
     //----------------------------
 
@@ -322,7 +328,8 @@ class PQStuckPointPublicController: BFBaseViewController {
         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 +352,7 @@ class PQStuckPointPublicController: BFBaseViewController {
                 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 +420,7 @@ class PQStuckPointPublicController: BFBaseViewController {
 
     // 除了播放器以外的 下半部分操作区
     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 +957,7 @@ extension PQStuckPointPublicController {
             /// fp2-1-2 - 保存视频到相册
             saveStuckPointVideo()
         } else {
-//            cShowHUB(superView: nil, msg: "您尚未打开相册权限,请到设置页打开相册权限")
+            cShowHUB(superView: nil, msg: "您尚未打开相册权限,请到设置页打开相册权限")
         }
     }
 
@@ -961,6 +968,7 @@ extension PQStuckPointPublicController {
         
         if(saveMovieLocalURL == nil){
             BFLog(message: "保存相册的视频导出地址无效!!!")
+            cShowHUB(superView: nil, msg: "保存相册的视频导出地址无效")
             saveVideoTipsLabel.text = "视频保存失败"
             saveRetryBtn.isHidden = false
             saveVideoTipsBgView.isHidden = false
@@ -973,8 +981,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 +1007,7 @@ extension PQStuckPointPublicController {
                 }
             }
         } else {
-//                cShowHUB(superView: nil, msg: "您尚未打开相册权限,请到设置页打开相册权限")
+            cShowHUB(superView: nil, msg: "您尚未打开相册权限,请到设置页打开相册权限")
         }
     }
 
@@ -1315,9 +1325,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 +1334,9 @@ extension PQStuckPointPublicController {
                     self?.saveVideoTipsBgView.isHidden = true
                 }
             }
+            if self.isSaveingLocalVideo{
+                saveVideoTipsBgView.isHidden = false
+            }
             
         }
     }
@@ -1438,9 +1450,10 @@ extension PQStuckPointPublicController {
             // 发送通知
             postNotification(name: cFinishedPublishedNotiKey)
         case 97:
+            // 视频保存重试
             saveRetryBtn.isHidden = true
             saveVideoTipsLabel.text = "视频保存中..."
-            self.saveStuckPointVideo()
+            saveStuckPointVideo()
         default:
             break
         }

+ 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){

+ 12 - 1
BFFramework/Classes/Stuckpoint/ViewModel/PQGPUImagePlayerView.swift

@@ -158,6 +158,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 +228,7 @@ public class PQGPUImagePlayerView: UIView {
     override public init(frame: CGRect) {
         super.init(frame: frame)
 
+        
         addSubview(renderView)
         addSubview(progressLab)
         addSubview(playMaskView)
@@ -392,7 +396,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)
 

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

@@ -135,10 +135,10 @@ class PQUploadController: BFBaseViewController {
         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: BFBaseViewController {
         } else {
             automaticallyAdjustsScrollViewInsets = false
         }
-        categoryCollectionView.backgroundColor = .white
+        categoryCollectionView.backgroundColor = PQBFConfig.shared.editCoverimageSelectedbackgroundColor
         return categoryCollectionView
     }()
 
@@ -247,21 +247,23 @@ class PQUploadController: BFBaseViewController {
         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: BFBaseViewController {
 
     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 {