Media3 Version
1.0.0-beta03
Devices that reproduce the issue
Various devices running android 12 and android 13
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
Wasn't able to reproduce it myself but I'm still reporting this because it was mentioned in #111 that we should report it if it happens on Android 13. According to crashlytics this happens 100% in background. By the logs I see various scenarios how this happens but most common one is when player is auto transitioning to next item.
Some additional info that might help indicate the problem:
- We are releasing
MediaController when user goes to background
- On media item transition we are saving current item to DB, if it was listened before we are seeking to it's last listened position and adjusting
playWhenReady if user has turned off/on autoplay. (But doubt this is causing any issues since crashes happen not only when item is transitioning)
onTaskRemoved we are doing stopSelf if player.playWhenReady != true
- We do not override
onUpdateNotification, but we are setting a custom MediaNotification.Provider
I can provide any additional info or logs if needed
Expected result
Not getting ForegroundServiceStartNotAllowedException and successfully continuing playback in background.
Actual result
Fatal Exception: android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service com.podimo/.app.core.media.MediaService
at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
at android.os.Parcel.readParcelable(Parcel.java:3345)
at android.os.Parcel.createExceptionOrNull(Parcel.java:2432)
at android.os.Parcel.createException(Parcel.java:2421)
at android.os.Parcel.readException(Parcel.java:2404)
at android.os.Parcel.readException(Parcel.java:2346)
at android.app.IActivityManager$Stub$Proxy.startService(IActivityManager.java:6968)
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1927)
at android.app.ContextImpl.startForegroundService(ContextImpl.java:1893)
at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:798)
at com.podimo.app.core.media.MediaService.startForegroundService(MediaService.kt:153)
at androidx.core.content.ContextCompat$Api26Impl.startForegroundService(ContextCompat.java:931)
at androidx.core.content.ContextCompat.startForegroundService(ContextCompat.java:703)
at androidx.media3.session.MediaNotificationManager.updateNotificationInternal(MediaNotificationManager.java:206)
at androidx.media3.session.MediaNotificationManager.updateNotification(MediaNotificationManager.java:182)
at androidx.media3.session.MediaSessionService.onUpdateNotification(MediaSessionService.java:411)
at androidx.media3.session.MediaNotificationManager$MediaControllerListener.onEvents(MediaNotificationManager.java:299)
at androidx.media3.session.MediaControllerImplBase.lambda$new$0(MediaControllerImplBase.java:151)
at androidx.media3.session.MediaControllerImplBase$$InternalSyntheticLambda$3$10aed4c532fdc841d63f0af013a047ffd34a0b4b9b1d6da420408b3dbfb435a8$0.invoke(MediaControllerImplBase.java:1)
at androidx.media3.common.util.ListenerSet$ListenerHolder.iterationFinished(ListenerSet.java:295)
at androidx.media3.common.util.ListenerSet.handleMessage(ListenerSet.java:246)
at androidx.media3.common.util.ListenerSet$$InternalSyntheticLambda$1$0a1dffe138e30e7ad8eb5a169bfb4852f73945d310b0f0a49ed6bc74e8c308ab$0.handleMessage$bridge(ListenerSet.java:57)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8669)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit
$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Media
Bug Report
Media3 Version
1.0.0-beta03
Devices that reproduce the issue
Various devices running android 12 and android 13
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
Wasn't able to reproduce it myself but I'm still reporting this because it was mentioned in #111 that we should report it if it happens on Android 13. According to crashlytics this happens 100% in background. By the logs I see various scenarios how this happens but most common one is when player is auto transitioning to next item.
Some additional info that might help indicate the problem:
MediaControllerwhen user goes to backgroundplayWhenReadyif user has turned off/on autoplay. (But doubt this is causing any issues since crashes happen not only when item is transitioning)onTaskRemovedwe are doingstopSelfifplayer.playWhenReady != trueonUpdateNotification, but we are setting a customMediaNotification.ProviderI can provide any additional info or logs if needed
Expected result
Not getting
ForegroundServiceStartNotAllowedExceptionand successfully continuing playback in background.Actual result
Media
Bug Report
adb bugreportto dev.exoplayer@gmail.com after filing this issue.