diff --git a/audio_service/CHANGELOG.md b/audio_service/CHANGELOG.md index fde60899..fa03546b 100644 --- a/audio_service/CHANGELOG.md +++ b/audio_service/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.18.12 + +* Fix crash with Oppo/OnePlus devices running Android 13. + ## 0.18.11 * Support custom media controls (@defsub) diff --git a/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioService.java b/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioService.java index ddb778ea..98775283 100644 --- a/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioService.java +++ b/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioService.java @@ -650,8 +650,10 @@ private Notification buildNotification() { builder.addAction(action); } final MediaStyle style = new MediaStyle() - .setMediaSession(mediaSession.getSessionToken()) - .setShowActionsInCompactView(compactActionIndices); + .setMediaSession(mediaSession.getSessionToken()); + if (Build.VERSION.SDK_INT < 33) { + style.setShowActionsInCompactView(compactActionIndices); + } if (config.androidNotificationOngoing) { style.setShowCancelButton(true); style.setCancelButtonIntent(buildMediaButtonPendingIntent(PlaybackStateCompat.ACTION_STOP)); @@ -772,7 +774,7 @@ private void releaseMediaSession() { * Gets called from background thread. */ synchronized void setQueue(List queue) { - this.queue = queue; + AudioService.queue = queue; mediaSession.setQueue(queue); } diff --git a/audio_service/pubspec.yaml b/audio_service/pubspec.yaml index dd0d03b4..a39bb466 100644 --- a/audio_service/pubspec.yaml +++ b/audio_service/pubspec.yaml @@ -1,6 +1,6 @@ name: audio_service description: Flutter plugin to play audio in the background while the screen is off. -version: 0.18.11 +version: 0.18.12 repository: https://github.com/ryanheise/audio_service/tree/minor/audio_service issue_tracker: https://github.com/ryanheise/audio_service/issues topics: