Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Fixed player crash when clearing app from recents ([#298])

## [1.5.0] - 2025-10-29
### Changed
Expand Down Expand Up @@ -81,6 +83,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#258]: https://github.com/FossifyOrg/Music-Player/issues/258
[#261]: https://github.com/FossifyOrg/Music-Player/issues/261
[#269]: https://github.com/FossifyOrg/Music-Player/issues/269
[#298]: https://github.com/FossifyOrg/Music-Player/issues/298

[Unreleased]: https://github.com/FossifyOrg/Music-Player/compare/1.5.0...HEAD
[1.5.0]: https://github.com/FossifyOrg/Music-Player/compare/1.4.0...1.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import org.fossify.musicplayer.playback.CustomCommands
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.io.File
import java.io.FileOutputStream

class MainActivity : SimpleMusicActivity() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.fossify.musicplayer.playback

import android.content.Intent
import android.os.Handler
import android.os.HandlerThread
import android.os.Looper
Expand Down Expand Up @@ -75,7 +76,9 @@ class PlaybackService : MediaLibraryService(), MediaSessionService.Listener {
}
}

internal fun withPlayer(callback: SimpleMusicPlayer.() -> Unit) = playerHandler.post { callback(player) }
internal fun withPlayer(callback: SimpleMusicPlayer.() -> Unit) {
playerHandler.post { callback(player) }
}

private fun showNoPermissionNotification() {
Handler(Looper.getMainLooper()).postDelayed(delayInMillis = 100L) {
Expand All @@ -99,6 +102,12 @@ class PlaybackService : MediaLibraryService(), MediaSessionService.Listener {
// todo: show a notification instead.
}

override fun onTaskRemoved(rootIntent: Intent?) {
playerHandler.post {
super.onTaskRemoved(rootIntent)
}
}

companion object {
// Initializing a media controller might take a noticeable amount of time thus we expose current playback info here to keep things as quick as possible.
var isPlaying: Boolean = false
Expand Down
Loading