|
|
|
@ -58,8 +58,6 @@ public class ProVideoActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
|
private ActivityMainProBinding mBinding;
|
|
|
|
|
private ProVideoView mVideoView; // 播放器View
|
|
|
|
|
private View mProgress;
|
|
|
|
|
|
|
|
|
|
private GestureDetector detector;
|
|
|
|
|
|
|
|
|
|
private VideoControllerView mediaController;
|
|
|
|
@ -131,7 +129,6 @@ public class ProVideoActivity extends AppCompatActivity {
|
|
|
|
|
mVideoView = mBinding.videoView;
|
|
|
|
|
mVideoView.setMediaController(mediaController);
|
|
|
|
|
|
|
|
|
|
mProgress = mBinding.progress;
|
|
|
|
|
mVideoView.setOnInfoListener((iMediaPlayer, arg1, arg2) -> {
|
|
|
|
|
switch (arg1) {
|
|
|
|
|
case IMediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING:
|
|
|
|
@ -139,7 +136,6 @@ public class ProVideoActivity extends AppCompatActivity {
|
|
|
|
|
break;
|
|
|
|
|
case IMediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START:
|
|
|
|
|
Log.i(TAG, "MEDIA_INFO_VIDEO_RENDERING_START");
|
|
|
|
|
mProgress.setVisibility(View.GONE);
|
|
|
|
|
mBinding.surfaceCover.setVisibility(View.GONE);
|
|
|
|
|
mBinding.playerContainer.setVisibility(View.GONE);
|
|
|
|
|
mBinding.videoView.setVisibility(View.VISIBLE);
|
|
|
|
@ -182,7 +178,6 @@ public class ProVideoActivity extends AppCompatActivity {
|
|
|
|
|
mVideoView.setOnErrorListener((iMediaPlayer, i, i1) -> {
|
|
|
|
|
Log.i(TAG, "播放错误");
|
|
|
|
|
mBinding.videoView.setVisibility(View.GONE);
|
|
|
|
|
mProgress.setVisibility(View.GONE);
|
|
|
|
|
mBinding.playerContainer.setVisibility(View.VISIBLE);
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
@ -190,7 +185,6 @@ public class ProVideoActivity extends AppCompatActivity {
|
|
|
|
|
mVideoView.setOnCompletionListener(iMediaPlayer -> {
|
|
|
|
|
Log.i(TAG, "播放完成");
|
|
|
|
|
mVideoView.seekTo(0);
|
|
|
|
|
mProgress.setVisibility(View.GONE);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
mVideoView.setOnPreparedListener(iMediaPlayer -> Log.i(TAG, String.format("onPrepared")));
|
|
|
|
|