|
@@ -52,6 +52,8 @@ class NCPlayerToolBar: UIView {
|
|
private var metadata: tableMetadata?
|
|
private var metadata: tableMetadata?
|
|
private var wasInPlay: Bool = false
|
|
private var wasInPlay: Bool = false
|
|
|
|
|
|
|
|
+ private weak var viewerMediaPage: NCViewerMediaPage?
|
|
|
|
+
|
|
// MARK: - View Life Cycle
|
|
// MARK: - View Life Cycle
|
|
|
|
|
|
override func awakeFromNib() {
|
|
override func awakeFromNib() {
|
|
@@ -105,10 +107,11 @@ class NCPlayerToolBar: UIView {
|
|
|
|
|
|
// MARK: -
|
|
// MARK: -
|
|
|
|
|
|
- func setBarPlayer(ncplayer: NCPlayer, position: Float, metadata: tableMetadata) {
|
|
|
|
|
|
+ func setBarPlayer(ncplayer: NCPlayer, position: Float, metadata: tableMetadata, viewerMediaPage: NCViewerMediaPage?) {
|
|
|
|
|
|
self.ncplayer = ncplayer
|
|
self.ncplayer = ncplayer
|
|
self.metadata = metadata
|
|
self.metadata = metadata
|
|
|
|
+ self.viewerMediaPage = viewerMediaPage
|
|
|
|
|
|
playButton.setImage(NCUtility.shared.loadImage(named: "play.fill", color: .white, symbolConfiguration: UIImage.SymbolConfiguration(pointSize: 30)), for: .normal)
|
|
playButton.setImage(NCUtility.shared.loadImage(named: "play.fill", color: .white, symbolConfiguration: UIImage.SymbolConfiguration(pointSize: 30)), for: .normal)
|
|
MPNowPlayingInfoCenter.default().nowPlayingInfo?[MPNowPlayingInfoPropertyPlaybackRate] = 0
|
|
MPNowPlayingInfoCenter.default().nowPlayingInfo?[MPNowPlayingInfoPropertyPlaybackRate] = 0
|
|
@@ -196,15 +199,16 @@ class NCPlayerToolBar: UIView {
|
|
|
|
|
|
switch touchEvent.phase {
|
|
switch touchEvent.phase {
|
|
case .began:
|
|
case .began:
|
|
|
|
+ viewerMediaPage?.timerAutoHide?.invalidate()
|
|
playbackSliderEvent = .began
|
|
playbackSliderEvent = .began
|
|
case .moved:
|
|
case .moved:
|
|
ncplayer.playerPosition(newPosition)
|
|
ncplayer.playerPosition(newPosition)
|
|
- NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterStartTimerAutoHideMediaPage)
|
|
|
|
playbackSliderEvent = .moved
|
|
playbackSliderEvent = .moved
|
|
case .ended:
|
|
case .ended:
|
|
ncplayer.playerPosition(newPosition)
|
|
ncplayer.playerPosition(newPosition)
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
|
self.playbackSliderEvent = .ended
|
|
self.playbackSliderEvent = .ended
|
|
|
|
+ self.viewerMediaPage?.startTimerAutoHide()
|
|
}
|
|
}
|
|
default:
|
|
default:
|
|
break
|
|
break
|
|
@@ -226,7 +230,7 @@ class NCPlayerToolBar: UIView {
|
|
ncplayer.playerPlay()
|
|
ncplayer.playerPlay()
|
|
}
|
|
}
|
|
|
|
|
|
- NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterStartTimerAutoHideMediaPage)
|
|
|
|
|
|
+ self.viewerMediaPage?.startTimerAutoHide()
|
|
}
|
|
}
|
|
|
|
|
|
@IBAction func tapMute(_ sender: Any) {
|
|
@IBAction func tapMute(_ sender: Any) {
|
|
@@ -243,7 +247,7 @@ class NCPlayerToolBar: UIView {
|
|
muteButton.setImage(NCUtility.shared.loadImage(named: "audioOn", color: .white), for: .normal)
|
|
muteButton.setImage(NCUtility.shared.loadImage(named: "audioOn", color: .white), for: .normal)
|
|
}
|
|
}
|
|
|
|
|
|
- NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterStartTimerAutoHideMediaPage)
|
|
|
|
|
|
+ self.viewerMediaPage?.startTimerAutoHide()
|
|
}
|
|
}
|
|
|
|
|
|
@IBAction func tapForward(_ sender: Any) {
|
|
@IBAction func tapForward(_ sender: Any) {
|
|
@@ -252,7 +256,7 @@ class NCPlayerToolBar: UIView {
|
|
|
|
|
|
ncplayer.jumpForward(10)
|
|
ncplayer.jumpForward(10)
|
|
|
|
|
|
- NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterStartTimerAutoHideMediaPage)
|
|
|
|
|
|
+ self.viewerMediaPage?.startTimerAutoHide()
|
|
}
|
|
}
|
|
|
|
|
|
@IBAction func tapBack(_ sender: Any) {
|
|
@IBAction func tapBack(_ sender: Any) {
|
|
@@ -261,6 +265,6 @@ class NCPlayerToolBar: UIView {
|
|
|
|
|
|
ncplayer.jumpBackward(10)
|
|
ncplayer.jumpBackward(10)
|
|
|
|
|
|
- NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterStartTimerAutoHideMediaPage)
|
|
|
|
|
|
+ self.viewerMediaPage?.startTimerAutoHide()
|
|
}
|
|
}
|
|
}
|
|
}
|