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

Commit cd445624 authored by Teng-Hui Zhu's avatar Teng-Hui Zhu
Browse files

Fix a crash

bug:4139931
Change-Id: Ifc18f964d5aedb268eb0d5fa08db3ffed1de4ff8
parent 0b933c02
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -209,9 +209,6 @@ public class HTML5VideoFullScreen extends HTML5VideoView
                // which happens when the video view is detached from its parent
                // view. This happens in the WebChromeClient before this method
                // is invoked.
                mTimer.cancel();
                mTimer = null;

                pauseAndDispatch(mProxy);

                mLayout.removeView(getSurfaceView());
+15 −6
Original line number Diff line number Diff line
@@ -68,6 +68,14 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
    // common Video control FUNCTIONS:
    public void start() {
        if (mCurrentState == STATE_PREPARED) {
            // When replaying the same video, there is no onPrepared call.
            // Therefore, the timer should be set up here.
            if (mTimer == null)
            {
                mTimer = new Timer();
                mTimer.schedule(new TimeupdateTask(mProxy), TIMEUPDATE_PERIOD,
                        TIMEUPDATE_PERIOD);
            }
            mPlayer.start();
        }
    }
@@ -76,8 +84,12 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
        if (mCurrentState == STATE_PREPARED && mPlayer.isPlaying()) {
            mPlayer.pause();
        }

        // Delete the Timer to stop it since there is no stop call.
        if (mTimer != null) {
            mTimer.purge();
            mTimer.cancel();
            mTimer = null;
        }
    }

@@ -129,6 +141,7 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
        mVideoLayerId = videoLayerId;
        mSaveSeekTime = position;
        mAutostart = autoStart;
        mTimer = null;
    }

    protected HTML5VideoView() {
@@ -153,8 +166,6 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
        // When switching players, surface texture will be reused.
        mUri = uri;
        mHeaders = generateHeaders(uri, proxy);

        mTimer = new Timer();
    }

    // Listeners setup FUNCTIONS:
@@ -228,11 +239,9 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
    public void onPrepared(MediaPlayer mp) {
        mCurrentState = STATE_PREPARED;
        seekTo(mSaveSeekTime);
        if (mProxy != null)
        if (mProxy != null) {
            mProxy.onPrepared(mp);

        mTimer.schedule(new TimeupdateTask(mProxy), TIMEUPDATE_PERIOD, TIMEUPDATE_PERIOD);

        }
    }

    // Pause the play and update the play/pause button