提交 086ef48d 编写于 作者: Z Zhang Rui

MediaController: use long to store duration and position

上级 836cf6bd
...@@ -83,7 +83,7 @@ public class MediaController extends FrameLayout { ...@@ -83,7 +83,7 @@ public class MediaController extends FrameLayout {
private TextView mFileName; private TextView mFileName;
private OutlineTextView mInfoView; private OutlineTextView mInfoView;
private String mTitle; private String mTitle;
private int mDuration; private long mDuration;
private boolean mShowing; private boolean mShowing;
private boolean mDragging; private boolean mDragging;
private boolean mInstantSeeking = true; private boolean mInstantSeeking = true;
...@@ -385,8 +385,8 @@ public class MediaController extends FrameLayout { ...@@ -385,8 +385,8 @@ public class MediaController extends FrameLayout {
return position; return position;
} }
private static String generateTime(int position) { private static String generateTime(long position) {
int totalSeconds = position / 1000; int totalSeconds = (int) (position / 1000);
int seconds = totalSeconds % 60; int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60; int minutes = (totalSeconds / 60) % 60;
...@@ -485,7 +485,7 @@ public class MediaController extends FrameLayout { ...@@ -485,7 +485,7 @@ public class MediaController extends FrameLayout {
if (!fromuser) if (!fromuser)
return; return;
int newposition = (mDuration * progress) / 1000; long newposition = (mDuration * progress) / 1000;
String time = generateTime(newposition); String time = generateTime(newposition);
if (mInstantSeeking) if (mInstantSeeking)
mPlayer.seekTo(newposition); mPlayer.seekTo(newposition);
......
...@@ -629,7 +629,7 @@ public class VideoView extends SurfaceView implements ...@@ -629,7 +629,7 @@ public class VideoView extends SurfaceView implements
@Override @Override
public void seekTo(long msec) { public void seekTo(long msec) {
if (isInPlaybackState()) { if (isInPlaybackState()) {
mMediaPlayer.seekTo((int) msec); mMediaPlayer.seekTo(msec);
mSeekWhenPrepared = 0; mSeekWhenPrepared = 0;
} else { } else {
mSeekWhenPrepared = msec; mSeekWhenPrepared = msec;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册