mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Kinda fixed the timeline issue
This commit is contained in:
parent
3c62d22ddf
commit
b053c4ca33
1 changed files with 3 additions and 12 deletions
|
|
@ -181,18 +181,9 @@ final class NowPlayingController: ObservableObject, MediaControllerProtocol {
|
||||||
newPlaybackState.album = payload.album ?? (diff ? self.playbackState.album : "")
|
newPlaybackState.album = payload.album ?? (diff ? self.playbackState.album : "")
|
||||||
newPlaybackState.duration = payload.duration ?? (diff ? self.playbackState.duration : 0)
|
newPlaybackState.duration = payload.duration ?? (diff ? self.playbackState.duration : 0)
|
||||||
|
|
||||||
if let elapsedTime = payload.elapsedTime {
|
// Match boring.notch behavior: if elapsedTime is provided use it,
|
||||||
newPlaybackState.currentTime = elapsedTime
|
// if this update is a diff keep the previous currentTime, otherwise default to 0.
|
||||||
} else if diff {
|
newPlaybackState.currentTime = payload.elapsedTime ?? (diff ? self.playbackState.currentTime : 0)
|
||||||
if payload.playing == false {
|
|
||||||
let timeSinceLastUpdate = Date().timeIntervalSince(self.playbackState.lastUpdated)
|
|
||||||
newPlaybackState.currentTime = self.playbackState.currentTime + (self.playbackState.playbackRate * timeSinceLastUpdate)
|
|
||||||
} else {
|
|
||||||
newPlaybackState.currentTime = self.playbackState.currentTime
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
newPlaybackState.currentTime = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if let shuffleMode = payload.shuffleMode {
|
if let shuffleMode = payload.shuffleMode {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue