mirror of
https://github.com/sudoxnym/audiobookshelf-atv.git
synced 2026-04-14 11:36:27 +00:00
Fix getCurrentTime for streaming session.
This simplifies logic to use session current time when session current track start offset is unavailable.
This commit is contained in:
parent
45d3a15c68
commit
605b52df0e
1 changed files with 3 additions and 6 deletions
|
|
@ -511,13 +511,10 @@ class AudioPlayer: NSObject {
|
|||
let audioTrack = playbackSession.audioTracks[currentTrackIndex]
|
||||
let startOffset = audioTrack.startOffset ?? 0.0
|
||||
|
||||
// if the currentTrackTime is not a number, then track isn't loaded
|
||||
// fall back on session.
|
||||
var currentTrackTime = self.audioPlayer.currentTime().seconds
|
||||
// if the currentTrackTime isNan, then fall back on session.
|
||||
let currentTrackTime = self.audioPlayer.currentTime().seconds
|
||||
if currentTrackTime.isNaN {
|
||||
if let currentChapter = playbackSession.getCurrentChapter() {
|
||||
currentTrackTime = currentChapter.getRelativeChapterCurrentTime(sessionCurrentTime:playbackSession.currentTime)
|
||||
}
|
||||
return playbackSession.currentTime
|
||||
}
|
||||
return startOffset + currentTrackTime
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue