Search in sources :

Example 1 with PLOnPreparedListener

use of com.pili.pldroid.player.PLOnPreparedListener in project PLDroidPlayer by pili-engineering.

the class ChangeActivity method initLive.

private void initLive() {
    // mVideoView = new PLVideoView(this);
    // mBinding.main2VideoLayout.removeAllViews();
    // mBinding.main2VideoLayout.addView(mVideoView);
    mVideoView.setOnPreparedListener(new PLOnPreparedListener() {

        @Override
        public void onPrepared(int i) {
            Log.i("==plVideo==", "onPrepared:" + i);
            mVideoView.start();
        }
    });
    mVideoView.setOnInfoListener(new PLOnInfoListener() {

        @Override
        public void onInfo(int i, int i1, Object o) {
            if (i == PLOnInfoListener.MEDIA_INFO_VIDEO_RENDERING_START) {
                Log.i("==plVideo==", "onInfo:" + i + "," + i1);
            }
        }
    });
    mVideoView.setOnCompletionListener(new PLOnCompletionListener() {

        @Override
        public void onCompletion() {
            Log.i("==plVideo==", "onCompletion:");
        }
    });
    mVideoView.setOnVideoSizeChangedListener(new PLOnVideoSizeChangedListener() {

        @Override
        public void onVideoSizeChanged(int i, int i1) {
            Log.i("==plVideo==", "onVideoSizeChanged:" + i + "," + i1);
        }
    });
    mVideoView.setOnErrorListener(new PLOnErrorListener() {

        @Override
        public boolean onError(int i, Object o) {
            Log.i("==plVideo==", "onError:" + i);
            return false;
        }
    });
    // mVideoView.setDisplayAspectRatio(PLVideoView.ASPECT_RATIO_ORIGIN);
    mVideoView.setDisplayAspectRatio(PLVideoView.ASPECT_RATIO_FIT_PARENT);
    // mVideoView.setDisplayAspectRatio(PLVideoView.ASPECT_RATIO_PAVED_PARENT);
    // mVideoView.setDisplayAspectRatio(PLVideoView.ASPECT_RATIO_16_9);
    // mVideoView.setDisplayAspectRatio(PLVideoView.ASPECT_RATIO_4_3);
    mVideoView.setAVOptions(getAVOptions());
    mVideoView.setVideoPath(url1);
}
Also used : PLOnErrorListener(com.pili.pldroid.player.PLOnErrorListener) PLOnCompletionListener(com.pili.pldroid.player.PLOnCompletionListener) PLOnPreparedListener(com.pili.pldroid.player.PLOnPreparedListener) PLOnInfoListener(com.pili.pldroid.player.PLOnInfoListener) PLOnVideoSizeChangedListener(com.pili.pldroid.player.PLOnVideoSizeChangedListener)

Example 2 with PLOnPreparedListener

use of com.pili.pldroid.player.PLOnPreparedListener 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

PLOnPreparedListener (com.pili.pldroid.player.PLOnPreparedListener)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 PagerSnapHelper (android.support.v7.widget.PagerSnapHelper)1 PLOnCompletionListener (com.pili.pldroid.player.PLOnCompletionListener)1 PLOnErrorListener (com.pili.pldroid.player.PLOnErrorListener)1 PLOnInfoListener (com.pili.pldroid.player.PLOnInfoListener)1 PLOnVideoSizeChangedListener (com.pili.pldroid.player.PLOnVideoSizeChangedListener)1 PLShortVideoTextureView (com.pili.pldroid.player.widget.PLShortVideoTextureView)1