desc:播放本地视频播放器样式调整

main
xiaowusky 2 years ago
parent f854787b2a
commit baa280fff0

@ -29,7 +29,7 @@ import tv.danmaku.ijk.media.widget.media.IMediaController;
/**
*
*
* <p>
* Created by jiaozebo on 2017/6/11.
*/
public class VideoControllerView extends FrameLayout implements IMediaController {
@ -62,11 +62,6 @@ public class VideoControllerView extends FrameLayout implements IMediaController
private ImageButton mFastButton; // 快进
private ImageButton mRewindButton; // 快退
private long mReceivedBytes;
private long mReceivedPackets;
private long lastBitsMillis;
private long recordBeginTime;
private Handler mHandler = new MessageHandler(this);
private Runnable mSeekingPending;
@ -77,15 +72,6 @@ public class VideoControllerView extends FrameLayout implements IMediaController
show(sDefaultTimeout);
};
// 全屏的点击事件
private OnClickListener mFullscreenListener = v -> {
doToggleFullscreen();
show(sDefaultTimeout);
};
// 录像的点击事件
private OnClickListener mRecordingListener = v -> show(sDefaultTimeout);
// 滚动条的点击事件
private OnSeekBarChangeListener mSeekListener = new OnSeekBarChangeListener() {
public void onStartTrackingTouch(SeekBar bar) {
@ -138,6 +124,9 @@ public class VideoControllerView extends FrameLayout implements IMediaController
int pos = mPlayer.getCurrentPosition();
pos -= 5000; // милисекунд
if (pos < 0) {
pos = 0;
}
mPlayer.seekTo(pos);
setProgress();
@ -161,7 +150,9 @@ public class VideoControllerView extends FrameLayout implements IMediaController
}
};
/** ==================== constructor ==================== */
/**
* ==================== constructor ====================
*/
public VideoControllerView(Context context, AttributeSet attrs) {
super(context, attrs);
@ -188,10 +179,12 @@ public class VideoControllerView extends FrameLayout implements IMediaController
Log.i(TAG, TAG);
}
/** ==================== system Override ==================== */
/**
* ==================== system Override ====================
*/
/*
* activityoncreate
* */
* activityoncreate
* */
@Override
public void onFinishInflate() {
super.onFinishInflate();
@ -201,8 +194,8 @@ public class VideoControllerView extends FrameLayout implements IMediaController
}
/*
* ()
* */
* ()
* */
@Override
public boolean onTrackballEvent(MotionEvent ev) {
show(sDefaultTimeout);
@ -210,8 +203,8 @@ public class VideoControllerView extends FrameLayout implements IMediaController
}
/*
*
* */
*
* */
@Override
public boolean onTouchEvent(MotionEvent event) {
show(sDefaultTimeout);
@ -272,7 +265,9 @@ public class VideoControllerView extends FrameLayout implements IMediaController
return super.dispatchKeyEvent(event);
}
/** ==================== IMediaController ==================== */
/**
* ==================== IMediaController ====================
*/
@Override
public void hide() {
@ -336,7 +331,6 @@ public class VideoControllerView extends FrameLayout implements IMediaController
@Override
public void setMediaPlayer(MediaController.MediaPlayerControl player) {
mPlayer = player;
updatePausePlay();
}
@ -494,7 +488,7 @@ public class VideoControllerView extends FrameLayout implements IMediaController
if (isCompleted) {
int duration = mPlayer.getDuration();
final int progress = mProgress.getProgress();
Log.d(TAG,String.valueOf(duration));
Log.d(TAG, String.valueOf(duration));
mSeekingPending = new Runnable() {
@Override
@ -505,11 +499,8 @@ public class VideoControllerView extends FrameLayout implements IMediaController
}
};
postDelayed(mSeekingPending,500);
postDelayed(mSeekingPending, 500);
}
mReceivedBytes = 0;
mReceivedPackets = 0;
}
updatePausePlay();
@ -553,7 +544,7 @@ public class VideoControllerView extends FrameLayout implements IMediaController
mProgress.setMax(duration);
mProgress.setProgress(position);
} else {
if (position > mProgress.getProgress()){
if (position > mProgress.getProgress()) {
mProgress.setProgress(position);
}
}

Loading…
Cancel
Save