florent37 / Flutter-AssetsAudioPlayer

Play simultaneously music/audio from assets/network/file directly from Flutter, compatible with android / ios / web / macos, displays notifications
https://pub.dartlang.org/packages/assets_audio_player
Apache License 2.0
740 stars 337 forks source link

CustomMediaButtonReceiver.onReceive #803

Open Sanam-Gurung opened 10 months ago

Sanam-Gurung commented 10 months ago

Flutter Version Flutter version : 3.13.1

Lib Version

Assets Audio Player version : 3.1.0

Platform (Android / iOS / web) + version

Platform : Android

Describe the bug

CustomMediaButtonReceiver.onReceive

Fatal Exception: android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{b4ae231 u0 com.goodvibes/com.github.florent37.assets_audio_player.notification.NotificationService}

Stack trace:

Fatal Exception: android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{b4ae231 u0 com.goodvibes/com.github.florent37.assets_audio_player.notification.NotificationService} at android.app.ActivityThread.generateForegroundServiceDidNotStartInTimeException(ActivityThread.java:2245) at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2216) at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2508) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8757) 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:1067)

seceba commented 9 months ago

Hi, I'm getting the same problem 3.1.1 update is related to this error?

Sanam-Gurung commented 9 months ago

Hi, I'm getting the same problem 3.1.1 update is related to this error? yes this problem didnot used to arise in the older version. @seceba

seceba commented 9 months ago

Version 3.0.6 does not have this problem. When I updated to version 3.1.0, I started to get this problem.

richtea99 commented 8 months ago

Also seeing this 'ForegroundServiceDidNotStartInTimeException' issue:

offline-first commented 7 months ago

any updates?

richtea99 commented 7 months ago

My update is 'sideways' - try the 'just_audio' package instead.

That's not to say this is a bad package, but 'just_audio' worked for our particular simple requirements, with minimal code changes.

seceba commented 7 months ago

So I had to use another package. audioplayers this package sees it.

vbuberen commented 4 months ago

I did a PR which was already merged into master and even though it is focused on changes for Android 14 it might have fixed this issue as well. Thus, I would ask some of those who experience the reported issue to try the version of this plugin from master pointing to my commit:

assets_audio_player:
    git:
      url: https://github.com/florent37/Flutter-AssetsAudioPlayer.git
      ref: 91638830570e5e3c2212d04fd99b8d3b60380dd3
mjjoshi commented 2 months ago

@vbuberen Can you please share version so update version accordingly

NebiSarigul commented 2 weeks ago

Any updates?