Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e5276cf authored by Teng-Hui Zhu's avatar Teng-Hui Zhu Committed by Android Git Automerger
Browse files

am 2c6f2816: am 5039e6da: Merge "fix for pause when loading" into honeycomb-mr1

* commit '2c6f2816':
  fix for pause when loading
parents b6955be9 2c6f2816
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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);
+3 −1
Original line number Diff line number Diff line
@@ -20,8 +20,10 @@ public class HTML5VideoInline extends HTML5VideoView{
    // Video control FUNCTIONS:
    @Override
    public void start() {
        if (!getPauseDuringPreparing()) {
            super.start();
        }
    }

    HTML5VideoInline(int videoLayerId, int position,
            boolean autoStart) {
+15 −6
Original line number Diff line number Diff line
@@ -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,17 +249,19 @@ 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();
        }
    }
    }

    // Below are functions that are different implementation on inline and full-
    // screen mode. Some are specific to one type, but currently are called
+2 −4
Original line number Diff line number Diff line
@@ -224,9 +224,7 @@ class HTML5VideoViewProxy extends Handler
        }

        public static void onPrepared() {
            if (!mHTML5VideoView.isFullScreenMode() ||
                    mHTML5VideoView.isFullScreenMode() &&
                    mHTML5VideoView.getAutostart() )
            // The VideoView will decide whether to really kick off to play.
            mHTML5VideoView.start();
            if (mBaseLayer != 0) {
                setBaseLayer(mBaseLayer);