|
@@ -25,7 +25,8 @@ class PQStuckPointPublicController: PQBaseViewController {
|
|
|
private var isSaveProjectSuccess: Bool = false // 是否保存项目完成
|
|
|
private var isUploadSuccess: Bool = false // 是否上传完成
|
|
|
private var isPublicSuccess: Bool = false // 是否发布完成
|
|
|
- private var exportLocalURL: URL? // 导出的地址
|
|
|
+ // 导出正片的地址
|
|
|
+ private var exportLocalURL: URL?
|
|
|
// 再创作数据
|
|
|
private var reCreateData: PQReCreateModel?
|
|
|
// 确定上传的数据
|
|
@@ -447,16 +448,16 @@ class PQStuckPointPublicController: PQBaseViewController {
|
|
|
|
|
|
// 保存重试
|
|
|
lazy var saveRetryBtn: UIButton = {
|
|
|
- let finishedBtn = UIButton(type: .custom)
|
|
|
- finishedBtn.setTitle("重试", for: .normal)
|
|
|
- finishedBtn.setTitleColor(UIColor.white, for: .normal)
|
|
|
- finishedBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium)
|
|
|
- finishedBtn.backgroundColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
|
|
|
- finishedBtn.tag = 97
|
|
|
- finishedBtn.isHidden = true
|
|
|
- finishedBtn.addCorner(corner: 5)
|
|
|
- finishedBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
|
|
|
- return finishedBtn
|
|
|
+ let saveRetryBtn = UIButton(type: .custom)
|
|
|
+ saveRetryBtn.setTitle("重试", for: .normal)
|
|
|
+ saveRetryBtn.setTitleColor(UIColor.white, for: .normal)
|
|
|
+ saveRetryBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium)
|
|
|
+ saveRetryBtn.backgroundColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
|
|
|
+ saveRetryBtn.tag = 97
|
|
|
+ saveRetryBtn.isHidden = true
|
|
|
+ saveRetryBtn.addCorner(corner: 5)
|
|
|
+ saveRetryBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
|
|
|
+ return saveRetryBtn
|
|
|
|
|
|
}()
|
|
|
|
|
@@ -861,8 +862,11 @@ extension PQStuckPointPublicController {
|
|
|
BFLog(message: "拼接后音频时长\(asset.duration.seconds) url is \(String(describing: completURL)) 用时\(CFAbsoluteTimeGetCurrent() - startMergeTime)")
|
|
|
//导出不带水印的正片
|
|
|
self?.beginExport(inputAsset: asset)
|
|
|
- //导出带水印的正片
|
|
|
- self?.beginExportWatermarkMovie(inputAsset:asset)
|
|
|
+
|
|
|
+ if(PQBFConfig.shared.enableWatermarkMovie){
|
|
|
+ //导出带水印的正片
|
|
|
+ self?.beginExportWatermarkMovie(inputAsset:asset)
|
|
|
+ }
|
|
|
}else{
|
|
|
cShowHUB(superView: self?.view, msg: "合成失败请重试。")
|
|
|
}
|
|
@@ -928,8 +932,15 @@ extension PQStuckPointPublicController {
|
|
|
self?.isExportSuccess = true
|
|
|
self?.exportEndDate = Date().timeIntervalSince1970
|
|
|
BFLog(message: "视频导出完成-开始去发布视频 总时长为\((self?.exportEndDate ?? 0) - (self?.startExportDate ?? 0) * 1000)")
|
|
|
-
|
|
|
+
|
|
|
self?.exportLocalURL = url
|
|
|
+
|
|
|
+
|
|
|
+ // add by ak 不生成水印视频时直接自动保存系统相册,e.g. 乐活圈中会执行
|
|
|
+ if(!PQBFConfig.shared.enableWatermarkMovie){
|
|
|
+ self?.authorizationStatus()
|
|
|
+ }
|
|
|
+
|
|
|
/// fp2-1-1 - 请求权限
|
|
|
// self?.authorizationStatus()
|
|
|
/// fp2-2 - 保存草稿
|
|
@@ -966,7 +977,9 @@ extension PQStuckPointPublicController {
|
|
|
/// - Returns: <#description#>
|
|
|
func saveStuckPointVideo() {
|
|
|
|
|
|
- if(saveMovieLocalURL == nil){
|
|
|
+ let tempSaveMoveiLocal:URL? = PQBFConfig.shared.enableWatermarkMovie ? saveMovieLocalURL : exportLocalURL
|
|
|
+
|
|
|
+ if(tempSaveMoveiLocal == nil){
|
|
|
BFLog(message: "保存相册的视频导出地址无效!!!")
|
|
|
cShowHUB(superView: nil, msg: "保存相册的视频导出地址无效")
|
|
|
saveVideoTipsLabel.text = "视频保存失败"
|
|
@@ -982,7 +995,7 @@ extension PQStuckPointPublicController {
|
|
|
let photoLibrary = PHPhotoLibrary.shared()
|
|
|
photoLibrary.performChanges({ [weak self] in
|
|
|
self?.isSaveingLocalVideo = true
|
|
|
- PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: (self?.saveMovieLocalURL)!)
|
|
|
+ PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: (tempSaveMoveiLocal)!)
|
|
|
}) { [weak self] isFinished, _ in
|
|
|
self?.isSaveingLocalVideo = false
|
|
|
DispatchQueue.main.async { [weak self] in
|
|
@@ -1326,7 +1339,8 @@ extension PQStuckPointPublicController {
|
|
|
bottomOprationBgView.isHidden = false
|
|
|
//add by ak 发布成功后如果带片尾的视频还没有生成成功时,出提示
|
|
|
self.saveRetryBtn.isHidden = true
|
|
|
- if(saveMovieLocalURL == nil && self.isSaveingLocalVideo){
|
|
|
+ self.saveVideoTipsBgView.isHidden = false
|
|
|
+ if(self.isSaveingLocalVideo){
|
|
|
saveVideoTipsLabel.text = "视频保存中..."
|
|
|
}else{
|
|
|
self.saveVideoTipsLabel.text = "视频已保存到相册"
|