mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Fix updating playing status
This commit is contained in:
parent
db98124de5
commit
df96c2dba0
@ -521,6 +521,12 @@ final class AVPlayerBackend: PlayerBackend {
|
|||||||
MPNowPlayingInfoCenter.default().playbackState = self.avPlayer.timeControlStatus == .playing ? .playing : .paused
|
MPNowPlayingInfoCenter.default().playbackState = self.avPlayer.timeControlStatus == .playing ? .playing : .paused
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if self.controls.isPlaying != self.isPlaying {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.controls.isPlaying = self.isPlaying
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let currentTime = self.currentTime {
|
if let currentTime = self.currentTime {
|
||||||
self.model.handleSegments(at: currentTime)
|
self.model.handleSegments(at: currentTime)
|
||||||
}
|
}
|
||||||
@ -562,7 +568,8 @@ final class AVPlayerBackend: PlayerBackend {
|
|||||||
private func addPlayerTimeControlStatusObserver() {
|
private func addPlayerTimeControlStatusObserver() {
|
||||||
playerTimeControlStatusObserver = avPlayer.observe(\.timeControlStatus) { [weak self] player, _ in
|
playerTimeControlStatusObserver = avPlayer.observe(\.timeControlStatus) { [weak self] player, _ in
|
||||||
guard let self = self,
|
guard let self = self,
|
||||||
self.avPlayer == player
|
self.avPlayer == player,
|
||||||
|
self.model.activeBackend == .appleAVPlayer
|
||||||
else {
|
else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -366,6 +366,7 @@ final class MPVBackend: PlayerBackend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func updateControlsIsPlaying() {
|
private func updateControlsIsPlaying() {
|
||||||
|
guard model.activeBackend == .mpv else { return }
|
||||||
DispatchQueue.main.async { [weak self] in
|
DispatchQueue.main.async { [weak self] in
|
||||||
self?.controls?.isPlaying = self?.isPlaying ?? false
|
self?.controls?.isPlaying = self?.isPlaying ?? false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user