mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-04 18:15:01 +02:00
Fix:Syncing when media is open in audio player and playing on another device #984
- Local playback session IDs have been updated to UUIDs instead of prefixing local_play_
This commit is contained in:
parent
dd66042766
commit
7412d0899f
5 changed files with 13 additions and 15 deletions
|
@ -164,7 +164,7 @@ extension LocalLibraryItem {
|
|||
|
||||
func getPlaybackSession(episode: PodcastEpisode?) -> PlaybackSession {
|
||||
let localEpisodeId = episode?.id
|
||||
let sessionId = "play_local_\(UUID().uuidString)"
|
||||
let sessionId = UUID().uuidString
|
||||
|
||||
// Get current progress from local media
|
||||
let mediaProgressId = (localEpisodeId != nil) ? "\(self.id)-\(localEpisodeId!)" : self.id
|
||||
|
|
|
@ -21,7 +21,7 @@ class PlayerHandler {
|
|||
cleanupOldSessions(currentSessionId: sessionId)
|
||||
|
||||
// Set now playing info
|
||||
NowPlayingInfo.shared.setSessionMetadata(metadata: NowPlayingMetadata(id: session.id, itemId: session.libraryItemId!, title: session.displayTitle ?? "Unknown title", author: session.displayAuthor, series: nil))
|
||||
NowPlayingInfo.shared.setSessionMetadata(metadata: NowPlayingMetadata(id: session.id, itemId: session.libraryItemId!, title: session.displayTitle ?? "Unknown title", author: session.displayAuthor, series: nil, isLocal: session.isLocal))
|
||||
|
||||
// Create the audio player
|
||||
player = AudioPlayer(sessionId: sessionId, playWhenReady: playWhenReady, playbackRate: playbackRate)
|
||||
|
|
|
@ -14,6 +14,7 @@ struct NowPlayingMetadata {
|
|||
var title: String
|
||||
var author: String?
|
||||
var series: String?
|
||||
var isLocal: Bool
|
||||
|
||||
var coverUrl: URL? {
|
||||
if self.isLocal {
|
||||
|
@ -25,8 +26,6 @@ struct NowPlayingMetadata {
|
|||
return url
|
||||
}
|
||||
}
|
||||
|
||||
var isLocal: Bool { id.starts(with: "play_local_") }
|
||||
}
|
||||
|
||||
class NowPlayingInfo {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue