java.lang.IllegalStateException: Handler (android.os.Handler) {ed82dba} sending message to a Handler on a dead thread
at android.os.MessageQueue.enqueueMessage(MessageQueue.java:325)
at android.os.Handler.enqueueMessage(Handler.java:631)
at android.os.Handler.sendMessageAtTime(Handler.java:600)
at android.os.Handler.sendMessageDelayed(Handler.java:570)
at android.os.Handler.sendMessage(Handler.java:507)
at android.os.Message.sendToTarget(Message.java:416)
at com.google.android.exoplayer.ExoPlayerImplInternal.prepare(ExoPlayerImplInternal.java:132)
at com.google.android.exoplayer.ExoPlayerImpl.prepare(ExoPlayerImpl.java:99)
at com.devbrackets.android.exomedia.exoplayer.EMExoPlayer.onRenderers(EMExoPlayer.java:285)
at com.devbrackets.android.exomedia.exoplayer.EMExoPlayer$InternalRendererBuilderCallback.onRenderers(EMExoPlayer.java:601)
at com.devbrackets.android.exomedia.builder.RenderBuilder.buildRenderers(RenderBuilder.java:95)
at com.devbrackets.android.exomedia.exoplayer.EMExoPlayer.prepare(EMExoPlayer.java:246)
at com.devbrackets.android.exomedia.exoplayer.EMExoPlayer.replaceRenderBuilder(EMExoPlayer.java:146)
at com.devbrackets.android.exomedia.EMVideoView.setVideoURI(EMVideoView.java:642)
at com.devbrackets.android.exomedia.EMVideoView.setVideoURI(EMVideoView.java:624)
mTitle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mEmVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mEmVideoView.start();
}
});
mEmVideoView.setVideoURI(Uri.parse("http://.....................mp4"));
}
});
I’ve added a method to allow disabling the releasing of resources in
onDetachedFromWindow()
https://github.com/brianwernick/ExoMedia/commit/ac950d9d6a21a24116482b6dd0fe57b4558ebeb9.On the other topic; I understand that there are many other libraries out there the handle a much broader range of devices. My main focus for this library was to simplify interaction with the ExoPlayer which isn’t supported on many devices (usually if they don’t have the Play Store then they don’t pass the CTS and therefore don’t support the ExoPlayer).
Thanks for the interesting discussion, but since I have added a solution I will close the bug.
Hm I’m working on the same thing with @daimajia . It turns out that your EMVideoView will release the
exoPlayer
inonDetachedFromWindow
, therefore the VideoView will no longer be useable after that point. Don’t have any good idea for this now, but please consider to improve this 😄. Is that safe to not release the player after the view got detached? I deeply understand that it may cause the memory leak of the Player, we can think about this for a better solution. Best Regards!When this happened, the video failed to play.