我想加载滚动的视频列表,就像tiktok滚动一样,我使用垂直viewpager将每个视频加载到不同的页面中,并使用texturevideo视图,当页面更改停止视频并启动当前聚焦的视频时,同样其他视频,但我没有得到正确的输出,请提供任何解决方案来实现。
谢谢。
@Override
public void onPageSelected(int position) {
Log.d("PAGER",position + "");
mCurrentFragmentPosition = position;
if (lastPosition > position) {
Log.e("Up",position+"");
Log.e("lastPosition",lastPosition+"");
// customAdapter.fastVideoViews.get(position).start(); customAdapter.fastVideoViews.get(lastPosition).pause();
}else if (lastPosition < position) {
Log.e("Down",position+"");
Log.e("lastPosition",lastPosition+"");
// customAdapter.fastVideoViews.get(position).start(); customAdapter.fastVideoViews.get(lastPosition).pause();
}
lastPosition = position;
customAdapter.fastVideoViews.get(position).start();
}
@Override
public void onPageScrollStateChanged(int position) {
}
});