Release ExoPlayer in RecyclerView

后端 未结 3 1697
被撕碎了的回忆
被撕碎了的回忆 2021-02-10 01:51

I am implementing the ExoPlayer in a RecyclerView. But while scrolling the Video stops, but not the audio.

How can I release the ExoPlayer in the RecyclerView? Or how c

3条回答
  •  -上瘾入骨i
    2021-02-10 02:39

      holder.yourplayername.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
                @Override
                public void onViewAttachedToWindow(View v) {
    
                }
    
                @Override
                public void onViewDetachedFromWindow(View v) {
                    holder.yourplayername.getPlayer().stop();
    
                }
            });
    

    hi.i hope this code helpful for you becuse work for me.

提交回复
热议问题