在我的应用中,我刚刚添加了RecyclerView,该列表包含多个视频。我需要在触摸视频时播放视频。并且需要在视频滚动显示时暂停。
mVideoPlayer_1.addMediaPlayerListener(new SimpleMainThreadMediaPlayerListener(){
@Override
public void onVideoPreparedMainThread() {
// We hide the cover when video is prepared. Playback is about to start
mVideoCover.setVisibility(View.INVISIBLE);
}
@Override
public void onVideoStoppedMainThread() {
// We show the cover when video is stopped
mVideoCover.setVisibility(View.VISIBLE);
}
@Override
public void onVideoCompletionMainThread() {
// We show the cover when video is completed
mVideoCover.setVisibility(View.VISIBLE);
}
});
mVideoPlayerManager.playNewVideo(null, mVideoPlayer_1, "http:\\url_to_you_video_1_source");
当滚动时,我需要暂停当前播放的视频。
答案 0 :(得分:0)
在RecyclerviewAdapter中使用onClickListener
,在“活动”中使用onScrollListener