any idea about the cause of this exception?
01-10 15:33:43.111 21717-21717/com.music.ofek.iplay E/AndroidRuntime: FATAL EXCEPTION: main Process: com.music.ofek.iplay, PID: 21717 java.lang.IllegalStateException: finishBroadcast() called outside of a broadcast at android.os.RemoteCallbackList.finishBroadcast(RemoteCallbackList.java:292) at android.support.v4.media.session.MediaSessionCompat$MediaSessionImplApi21.setPlaybackState(MediaSessionCompat.java:3226) at android.support.v4.media.session.MediaSessionCompat.setPlaybackState(MediaSessionCompat.java:608) at com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector.updateMediaSessionPlaybackState(MediaSessionConnector.java:521) at com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector.access$400(MediaSessionConnector.java:69) at com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector$ExoPlayerEventListener.onPlayerStateChanged(MediaSessionConnector.java:652) at com.google.android.exoplayer2.ExoPlayerImpl.handleEvent(ExoPlayerImpl.java:462) at com.google.android.exoplayer2.ExoPlayerImpl$1.handleMessage(ExoPlayerImpl.java:100) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5568) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Calling mediaSession.setActive(true) solved the problem
来源:https://stackoverflow.com/questions/48189204/mediasession-finishbroadcast-exception