Commit d9107a4b authored by Steven杜宇's avatar Steven杜宇

// 静音相关

parent 0718d473
...@@ -12,9 +12,16 @@ import AVFoundation ...@@ -12,9 +12,16 @@ import AVFoundation
class YHVideoPlayerControlView: BMPlayerControlView { class YHVideoPlayerControlView: BMPlayerControlView {
var isSilient = true {
didSet {
self.player?.avPlayer?.isMuted = isSilient
}
}
lazy var volumeBtn = { lazy var volumeBtn = {
let btn = UIButton() let btn = UIButton()
btn.setImage(UIImage(named: "mine_btn_setting"), for: .normal) btn.setImage(UIImage(named: "mine_btn_setting"), for: .normal)
btn.addTarget(self, action: #selector(didVolumeBtnClicked), for: .touchUpInside)
return btn return btn
}() }()
...@@ -52,4 +59,8 @@ class YHVideoPlayerControlView: BMPlayerControlView { ...@@ -52,4 +59,8 @@ class YHVideoPlayerControlView: BMPlayerControlView {
self.volumeBtn.alpha = alpha self.volumeBtn.alpha = alpha
}) })
} }
@objc func didVolumeBtnClicked() {
self.isSilient = !self.isSilient
}
} }
...@@ -127,6 +127,7 @@ class YHVideoPlayerVC: YHBaseViewController { ...@@ -127,6 +127,7 @@ class YHVideoPlayerVC: YHBaseViewController {
view.likeBlock = { [weak self] flag in view.likeBlock = { [weak self] flag in
guard let self = self else { return } guard let self = self else { return }
if YHLoginManager.shared.isLogin() == false { if YHLoginManager.shared.isLogin() == false {
self.player.pause()
let vc = UINavigationController(rootVC: YHPhoneLoginViewController()) let vc = UINavigationController(rootVC: YHPhoneLoginViewController())
vc.modalPresentationStyle = .custom vc.modalPresentationStyle = .custom
self.navigationController?.present(vc, animated: true) self.navigationController?.present(vc, animated: true)
...@@ -158,6 +159,7 @@ class YHVideoPlayerVC: YHBaseViewController { ...@@ -158,6 +159,7 @@ class YHVideoPlayerVC: YHBaseViewController {
view.starBlock = { [weak self] flag in view.starBlock = { [weak self] flag in
guard let self = self else { return } guard let self = self else { return }
if YHLoginManager.shared.isLogin() == false { if YHLoginManager.shared.isLogin() == false {
self.player.pause()
let vc = UINavigationController(rootVC: YHPhoneLoginViewController()) let vc = UINavigationController(rootVC: YHPhoneLoginViewController())
vc.modalPresentationStyle = .custom vc.modalPresentationStyle = .custom
self.navigationController?.present(vc, animated: true) self.navigationController?.present(vc, animated: true)
...@@ -259,6 +261,7 @@ extension YHVideoPlayerVC { ...@@ -259,6 +261,7 @@ extension YHVideoPlayerVC {
} }
return return
} }
self.player.pause()
YHShareManager.shared.sendVideoContent(title, "", thumbImg, link:link) YHShareManager.shared.sendVideoContent(title, "", thumbImg, link:link)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment