Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Android JWPlayer inside RecyclerView


In lack of a more suitable topic posting this in 'Streaming'.

I want to use the Android JWPlayerView inside a RecyclerView.
This works fine as long as the JWPlayerView is on-screen. As soon as the JWPlayerView is scrolled a bit off-screen, it throws the following exception:

E/ExoPlayerImplInternal: Stop failed.
java.lang.IllegalStateException
at android.media.MediaCodec.native_stop(Native Method)
at android.media.MediaCodec.stop(MediaCodec.java:1901)
at com.google.android.exoplayer.MediaCodecTrackRenderer.releaseCodec(SourceFile:469)
at com.google.android.exoplayer.MediaCodecTrackRenderer.onDisabled(SourceFile:434)
at com.google.android.exoplayer.MediaCodecVideoTrackRenderer.onDisabled(SourceFile:289)
at com.google.android.exoplayer.TrackRenderer.disable(SourceFile:231)
at com.google.android.exoplayer.ExoPlayerImplInternal.ensureDisabled(SourceFile:661)
at com.google.android.exoplayer.ExoPlayerImplInternal.stopAndDisable(SourceFile:562)
at com.google.android.exoplayer.ExoPlayerImplInternal.resetInternal(SourceFile:551)
at com.google.android.exoplayer.ExoPlayerImplInternal.stopInternal(SourceFile:528)
at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(SourceFile:247)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.google.android.exoplayer.util.PriorityHandlerThread.run(SourceFile:40)

The JWPlayerView is properly wired to the lifecycle events of the Activity it lives in. I thought the problem would occur when the view containing the JWPlayer is being recycled by the RecyclerView, but the error occurs before the view is being recycled. I also tried avoiding recycling for the JWPlayer viewtype alltogether with recyclerView.getRecycledViewPool().setMaxRecycledViews(0, 0), to no avail.

So, do you guys have any tipps or caveats when using JWPlayerView inside a RecyclerView on Android?

1 Community Answers

George

JW Player Support Agent  
0 rated :

Hi,

Could you link me to your source code?

This question has received the maximum number of answers.