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);
}
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;
}
});
}
}
Aggregations