Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error with control by media player controller apps #484

Merged
merged 2 commits into from
Oct 22, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ class MediaPlayerHolder:
sPlayOnFocusGain =
isMediaPlayer && state == GoConstants.PLAYING || state == GoConstants.RESUMED
}
AudioManager.AUDIOFOCUS_LOSS ->
AudioManager.AUDIOFOCUS_LOSS -> {
// Lost audio focus, probably "permanently"
mCurrentAudioFocusState = AUDIO_NO_FOCUS_NO_DUCK
stopPlaybackService(true)
}
}
// Update the player state based on the change
if (isPlaying || state == GoConstants.PAUSED && sRestoreVolume || state == GoConstants.PAUSED && sPlayOnFocusGain) {
Expand Down Expand Up @@ -468,9 +470,8 @@ class MediaPlayerHolder:
}

fun pauseMediaPlayer() {
// Do not pause foreground service, we will need to resume likely
MediaPlayerUtils.safePause(mediaPlayer)
ServiceCompat.stopForeground(mPlayerService, ServiceCompat.STOP_FOREGROUND_DETACH)
sNotificationForeground = false
state = GoConstants.PAUSED
updatePlaybackStatus(updateUI = true)
mMusicNotificationManager?.run {
Expand Down