Search in sources :

Example 1 with PLShortVideoTextureView

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;
            }
        });
    }
}
Also used : PLOnPreparedListener(com.pili.pldroid.player.PLOnPreparedListener) PLShortVideoTextureView(com.pili.pldroid.player.widget.PLShortVideoTextureView) PagerSnapHelper(android.support.v7.widget.PagerSnapHelper) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 PagerSnapHelper (android.support.v7.widget.PagerSnapHelper)1 PLOnPreparedListener (com.pili.pldroid.player.PLOnPreparedListener)1 PLShortVideoTextureView (com.pili.pldroid.player.widget.PLShortVideoTextureView)1