Skip to content

Commit

Permalink
Merge pull request #5635 from Bnyro/master
Browse files Browse the repository at this point in the history
refactor: don't recreate player on orientation change
  • Loading branch information
Bnyro committed Feb 18, 2024
2 parents 206479c + 0a4ccae commit aadf5bf
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 145 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ class OfflinePlayerService : LifecycleService() {
}

override fun onDestroy() {
nowPlayingNotification?.destroySelfAndPlayer()
nowPlayingNotification?.destroySelf()

player?.stop()
player?.release()
player = null
nowPlayingNotification = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,10 @@ class OnlinePlayerService : LifecycleService() {
// reset the playing queue
PlayingQueue.resetToDefaults()

if (this::nowPlayingNotification.isInitialized) nowPlayingNotification.destroySelfAndPlayer()
if (this::nowPlayingNotification.isInitialized) nowPlayingNotification.destroySelf()

player?.stop()
player?.release()

// called when the user pressed stop in the notification
// stop the service from being in the foreground and remove the notification
Expand Down
Loading

0 comments on commit aadf5bf

Please sign in to comment.