Merge "fix for pause when loading" into honeycomb-mr1
This commit is contained in:
@@ -114,6 +114,13 @@ public class HTML5VideoFullScreen extends HTML5VideoView
|
||||
return mVideoSurfaceView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if (getAutostart()) {
|
||||
super.start();
|
||||
}
|
||||
}
|
||||
|
||||
HTML5VideoFullScreen(Context context, int videoLayerId, int position,
|
||||
boolean autoStart) {
|
||||
mVideoSurfaceView = new VideoSurfaceView(context);
|
||||
|
||||
@@ -20,7 +20,9 @@ public class HTML5VideoInline extends HTML5VideoView{
|
||||
// Video control FUNCTIONS:
|
||||
@Override
|
||||
public void start() {
|
||||
super.start();
|
||||
if (!getPauseDuringPreparing()) {
|
||||
super.start();
|
||||
}
|
||||
}
|
||||
|
||||
HTML5VideoInline(int videoLayerId, int position,
|
||||
|
||||
@@ -65,6 +65,7 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
|
||||
// The spec says the timer should fire every 250 ms or less.
|
||||
private static final int TIMEUPDATE_PERIOD = 250; // ms
|
||||
|
||||
protected boolean mPauseDuringPreparing;
|
||||
// common Video control FUNCTIONS:
|
||||
public void start() {
|
||||
if (mCurrentState == STATE_PREPARED) {
|
||||
@@ -83,8 +84,9 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
|
||||
public void pause() {
|
||||
if (mCurrentState == STATE_PREPARED && mPlayer.isPlaying()) {
|
||||
mPlayer.pause();
|
||||
} else if (mCurrentState == STATE_NOTPREPARED) {
|
||||
mPauseDuringPreparing = true;
|
||||
}
|
||||
|
||||
// Delete the Timer to stop it since there is no stop call.
|
||||
if (mTimer != null) {
|
||||
mTimer.purge();
|
||||
@@ -133,6 +135,10 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
|
||||
return mAutostart;
|
||||
}
|
||||
|
||||
public boolean getPauseDuringPreparing() {
|
||||
return mPauseDuringPreparing;
|
||||
}
|
||||
|
||||
// Every time we start a new Video, we create a VideoView and a MediaPlayer
|
||||
public void init(int videoLayerId, int position, boolean autoStart) {
|
||||
mPlayer = new MediaPlayer();
|
||||
@@ -142,6 +148,7 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
|
||||
mSaveSeekTime = position;
|
||||
mAutostart = autoStart;
|
||||
mTimer = null;
|
||||
mPauseDuringPreparing = false;
|
||||
}
|
||||
|
||||
protected HTML5VideoView() {
|
||||
@@ -242,15 +249,17 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
|
||||
if (mProxy != null) {
|
||||
mProxy.onPrepared(mp);
|
||||
}
|
||||
if (mPauseDuringPreparing) {
|
||||
pauseAndDispatch(mProxy);
|
||||
mPauseDuringPreparing = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Pause the play and update the play/pause button
|
||||
public void pauseAndDispatch(HTML5VideoViewProxy proxy) {
|
||||
if (isPlaying()) {
|
||||
pause();
|
||||
if (proxy != null) {
|
||||
proxy.dispatchOnPaused();
|
||||
}
|
||||
pause();
|
||||
if (proxy != null) {
|
||||
proxy.dispatchOnPaused();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -224,10 +224,8 @@ class HTML5VideoViewProxy extends Handler
|
||||
}
|
||||
|
||||
public static void onPrepared() {
|
||||
if (!mHTML5VideoView.isFullScreenMode() ||
|
||||
mHTML5VideoView.isFullScreenMode() &&
|
||||
mHTML5VideoView.getAutostart() )
|
||||
mHTML5VideoView.start();
|
||||
// The VideoView will decide whether to really kick off to play.
|
||||
mHTML5VideoView.start();
|
||||
if (mBaseLayer != 0) {
|
||||
setBaseLayer(mBaseLayer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user