|
@@ -143,6 +143,22 @@ class PQStuckPointPublicController: PQBaseViewController {
|
|
|
playerHeaderView.clipsToBounds = true
|
|
|
return playerHeaderView
|
|
|
}()
|
|
|
+
|
|
|
+ // add by ak 播放器的封面 为了不和原有的播放器层级单独添加一个 view
|
|
|
+ lazy var playerHeaderCoverImageView: UIImageView = {
|
|
|
+ let playerHeaderCoverImageView = UIImageView.init()
|
|
|
+ playerHeaderCoverImageView.isUserInteractionEnabled = true
|
|
|
+ playerHeaderCoverImageView.contentMode = .scaleAspectFit
|
|
|
+ playerHeaderCoverImageView.clipsToBounds = true
|
|
|
+
|
|
|
+ let playBtn = UIButton(type: .custom)
|
|
|
+ playBtn.setImage(UIImage().BF_Image(named: "icon_video_play"), for: .normal)
|
|
|
+ playBtn.tag = 4
|
|
|
+ playBtn.isUserInteractionEnabled = false
|
|
|
+ playerHeaderCoverImageView.addSubview(playBtn)
|
|
|
+ playerHeaderCoverImageView.isHidden = true
|
|
|
+ return playerHeaderCoverImageView
|
|
|
+ }()
|
|
|
|
|
|
/// 播放器
|
|
|
lazy var avPlayer: AVPlayer = {
|
|
@@ -150,6 +166,9 @@ class PQStuckPointPublicController: PQBaseViewController {
|
|
|
NotificationCenter.default.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: avPlayer.currentItem, queue: .main) { [weak self] notify in
|
|
|
BFLog(message: "AVPlayerItemDidPlayToEndTime = \(notify)")
|
|
|
avPlayer.seek(to: CMTime.zero)
|
|
|
+ if(self?.playerHeaderCoverImageView.image != nil){
|
|
|
+ self?.playerHeaderCoverImageView.isHidden = false
|
|
|
+ }
|
|
|
self?.playBtn.isHidden = false
|
|
|
}
|
|
|
NotificationCenter.default.addObserver(forName: .AVPlayerItemNewErrorLogEntry, object: avPlayer.currentItem, queue: .main) { notify in
|
|
@@ -277,11 +296,18 @@ class PQStuckPointPublicController: PQBaseViewController {
|
|
|
publicTitleView.isHidden = true
|
|
|
publicTitleView.confirmBtnClock = { [weak self] title in
|
|
|
BFLog(message: "传出的 title is :\(String(describing: title))")
|
|
|
+ self?.changPlayerIsPause(isPause: false)
|
|
|
+
|
|
|
self?.setTitleText(text: title ?? "",textColor: .black)
|
|
|
//更新数据
|
|
|
self?.videoData?.title = title
|
|
|
self?.updateCoverImagegOrTitle()
|
|
|
}
|
|
|
+ publicTitleView.viewIsHiddenCallBack = { [weak self] in
|
|
|
+
|
|
|
+ self?.changPlayerIsPause(isPause: false)
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
return publicTitleView
|
|
|
}()
|
|
@@ -384,8 +410,8 @@ class PQStuckPointPublicController: PQBaseViewController {
|
|
|
playerHeaderView.frame = CGRect(origin: CGPoint(x: (cScreenWidth - preViewSize.width) / 2, y: (maxHeight - preViewSize.height) / 2), size: preViewSize)
|
|
|
let ges = UITapGestureRecognizer(target: self, action: #selector(playVideo))
|
|
|
playerHeaderView.addGestureRecognizer(ges)
|
|
|
- // 添加导出view
|
|
|
- bgTopView.addSubview(playerHeaderView)
|
|
|
+
|
|
|
+
|
|
|
if playerLayer.superlayer == nil {
|
|
|
playerHeaderView.layer.insertSublayer(playerLayer, at: 0)
|
|
|
}
|
|
@@ -394,6 +420,17 @@ class PQStuckPointPublicController: PQBaseViewController {
|
|
|
view.addSubview(oprationBgView)
|
|
|
oprationBgView.addSubview(progressTipsLab)
|
|
|
|
|
|
+ // 添加导出view
|
|
|
+ bgTopView.addSubview(playerHeaderView)
|
|
|
+
|
|
|
+ playerHeaderCoverImageView.frame = playerHeaderView.frame
|
|
|
+ playerHeaderCoverImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(playVideo)))
|
|
|
+
|
|
|
+ (playerHeaderCoverImageView.viewWithTag(4))?.frame =
|
|
|
+ CGRect(x: (preViewSize.width - cDefaultMargin * 5) / 2, y: (preViewSize.height - cDefaultMargin * 5) / 2, width: cDefaultMargin * 5, height: cDefaultMargin * 5)
|
|
|
+ bgTopView.addSubview(playerHeaderCoverImageView)
|
|
|
+
|
|
|
+
|
|
|
view.addSubview(bottomOprationBgView)
|
|
|
bottomOprationBgView.addSubview(remindLab)
|
|
|
bottomOprationBgView.addSubview(shareWechatBtn)
|
|
@@ -1027,14 +1064,12 @@ extension PQStuckPointPublicController {
|
|
|
}
|
|
|
|
|
|
/// 播放视频
|
|
|
- /// - Returns: <#description#>
|
|
|
+ /// - Returns: description
|
|
|
@objc func playVideo() {
|
|
|
playBtn.isHidden = !playBtn.isHidden
|
|
|
- if playBtn.isHidden {
|
|
|
- avPlayer.play()
|
|
|
- } else {
|
|
|
- avPlayer.pause()
|
|
|
- }
|
|
|
+
|
|
|
+ changPlayerIsPause(isPause: !playBtn.isHidden)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// 按钮点击事件
|
|
@@ -1091,12 +1126,11 @@ extension PQStuckPointPublicController {
|
|
|
|
|
|
backBtnClick()
|
|
|
|
|
|
-
|
|
|
// 点击上报:完成
|
|
|
PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_click_finished, pageSource: .sp_stuck_publishSyncedUp, extParams: ["videoId": videoData?.uniqueId ?? ""], remindmsg: "卡点视频数据上报-(点击上报:完成)")
|
|
|
-// navigationController?.viewControllers = [(navigationController?.viewControllers.first)!]
|
|
|
-// // 发送通知
|
|
|
-// postNotification(name: cFinishedPublishedNotiKey)
|
|
|
+ navigationController?.viewControllers = [(navigationController?.viewControllers.first)!]
|
|
|
+ // 发送通知
|
|
|
+ postNotification(name: cFinishSharedNotiKey)
|
|
|
|
|
|
default:
|
|
|
break
|
|
@@ -1142,6 +1176,9 @@ extension PQStuckPointPublicController {
|
|
|
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) { [weak self] in
|
|
|
self?.isShared = false
|
|
|
cShowHUB(superView: nil, msg: "分享成功")
|
|
|
+ self?.navigationController?.viewControllers = [(self?.navigationController?.viewControllers.first)!]
|
|
|
+ // 发送通知
|
|
|
+ postNotification(name: cFinishSharedNotiKey)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1156,12 +1193,31 @@ extension PQStuckPointPublicController {
|
|
|
progressTipsLab.attributedText = attributedText
|
|
|
}
|
|
|
|
|
|
+ func changPlayerIsPause(isPause:Bool) {
|
|
|
+ if(isPause){
|
|
|
+ playBtn.isHidden = false
|
|
|
+ avPlayer.pause()
|
|
|
+ playerHeaderCoverImageView.isHidden = false
|
|
|
+
|
|
|
+ }else{
|
|
|
+ playBtn.isHidden = true
|
|
|
+ avPlayer.play()
|
|
|
+ playerHeaderCoverImageView.isHidden = true
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@objc func titleLabelClick() {
|
|
|
BFLog(message: "点击输入框")
|
|
|
+ changPlayerIsPause(isPause: true)
|
|
|
+
|
|
|
pinView.isHidden = true
|
|
|
publicTitleView.isHidden = false
|
|
|
|
|
|
-
|
|
|
+ if(publicTitleView.inputTV.text.count > 0){
|
|
|
+ publicTitleView.inputTV.text = titleLabel.text
|
|
|
+ }
|
|
|
+
|
|
|
PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_clickButton_changeTitle, pageSource: .sp_stuck_publishSyncedUp, eventData: ["videoId":videoData?.uniqueId ?? "","rootPageSource":reCreateData != nil ? "shanyinApp-main-syncedUpMusicRecreate" :"shanyinApp-main-syncedUpMusic"], remindmsg: "")
|
|
|
}
|
|
|
|
|
@@ -1171,6 +1227,8 @@ extension PQStuckPointPublicController {
|
|
|
BFLog(message: "导出的视频地址错误???。。。")
|
|
|
return
|
|
|
}
|
|
|
+ changPlayerIsPause(isPause: true)
|
|
|
+
|
|
|
let asset = AVURLAsset(url: exportLocalURL!, options: nil)
|
|
|
|
|
|
publicEditCoverView.show(videoURL: exportLocalURL!, duration: CMTimeGetSeconds(asset.duration))
|
|
@@ -1178,9 +1236,15 @@ extension PQStuckPointPublicController {
|
|
|
//点击了确认 btn
|
|
|
publicEditCoverView.selectImageCallBack = { [weak self] imageData in
|
|
|
|
|
|
- self?.coverImageView.image = imageData
|
|
|
- self?.uploadData?.image = imageData
|
|
|
- self?.updateCoverImagegOrTitle()
|
|
|
+ self?.changPlayerIsPause(isPause: false)
|
|
|
+ if(imageData != nil){
|
|
|
+
|
|
|
+ self?.coverImageView.image = imageData
|
|
|
+ self?.playerHeaderCoverImageView.image = imageData
|
|
|
+ self?.uploadData?.image = imageData
|
|
|
+ self?.updateCoverImagegOrTitle()
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
//点击了从相册选择
|
|
|
publicEditCoverView.selectPhotoBtnCallBack = { [weak self] in
|
|
@@ -1237,14 +1301,8 @@ extension PQStuckPointPublicController {
|
|
|
})
|
|
|
|
|
|
}}
|
|
|
- func setTitleText(text:String ,textColor:UIColor = UIColor.hexColor(hexadecimal: "#ABABAB")) {
|
|
|
-// if(text.count > 15){
|
|
|
-// self?.titleLabel.numberOfLines = 2
|
|
|
-// self?.titleLabel.frame = CGRect.init(x: self?.titleLabel.frame.origin.x ?? 0, y: self?.titleLabel.frame.origin.y ?? 0, width: self?.titleLabel.frame.width ?? 0, height: 48)
|
|
|
-// }else{
|
|
|
-// self?.titleLabel.frame = CGRect.init(x: self?.titleLabel.frame.origin.x ?? 0, y: self?.titleLabel.frame.origin.y ?? 0, width: self?.titleLabel.frame.width ?? 0, height: 24)
|
|
|
-// }
|
|
|
-//
|
|
|
+ func setTitleText(text:String ,textColor:UIColor = UIColor.hexColor(hexadecimal: "#ABABAB")) {
|
|
|
+
|
|
|
selectTitle = text
|
|
|
//更新 UI
|
|
|
titleLabel.text = text
|
|
@@ -1274,9 +1332,11 @@ extension PQStuckPointPublicController {
|
|
|
@objc func imageSelectedImage(notify: Notification) {
|
|
|
let imageData: UIImage? = notify.userInfo?["image"] as? UIImage
|
|
|
if imageData != nil {
|
|
|
+ changPlayerIsPause(isPause: false)
|
|
|
BFLog(message: "从系统相册选择了一个照片")
|
|
|
publicEditCoverView.isHidden = true
|
|
|
coverImageView.image = imageData
|
|
|
+ playerHeaderCoverImageView.image = imageData
|
|
|
uploadData?.image = imageData
|
|
|
updateCoverImagegOrTitle()
|
|
|
}
|