use of com.pili.pldroid.player.widget.PLShortVideoTextureView in project PLDroidPlayer by pili-engineering.
the class ShortVideoListFragment method initView.
private void initView(View root) {
mVideoList = root.findViewById(R.id.video_list);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
mVideoList.setLayoutManager(layoutManager);
mVideoList.setHasFixedSize(true);
PagerSnapHelper snapHelper = new PagerSnapHelper();
snapHelper.attachToRecyclerView(mVideoList);
mVideoView = new PLShortVideoTextureView(getContext());
mVideoView.setOnPreparedListener(new PLOnPreparedListener() {
@Override
public void onPrepared(int preparedTime) {
mVideoView.start();
}
});
mShortVideoListAdapter = new ShortVideoListAdapter(mItemList, mVideoView);
mVideoList.setAdapter(mShortVideoListAdapter);
mVideoList.addOnScrollListener(mOnScrollListener);
if (mShouldPlay) {
mVideoList.post(new Runnable() {
@Override
public void run() {
startCurVideoView();
mShouldPlay = false;
}
});
}
}
Aggregations