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

Commit 8aab46ab authored by Andrei Popescu's avatar Andrei Popescu
Browse files

VideoPlayer::onPrepared() can be called after the user pressed back in the VideoView.

This can cass a NPE since our Timer would have been destroyed by then.

Add call to VideoView.stopPlayback() when the view is dismissed by the user.

Fix b: 24760020, 2475786, 2475786
parent b5e15690
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ class HTML5VideoViewProxy extends Handler
                    mTimer = null;
                    mCurrentProxy.playbackEnded();
                    mCurrentProxy = null;
                    mVideoView.stopPlayback();
                    mLayout.removeView(mVideoView);
                    mVideoView = null;
                    if (mProgressView != null) {
@@ -218,11 +219,10 @@ class HTML5VideoViewProxy extends Handler
        }

        public static void onPrepared() {
            mTimer.schedule(new TimeupdateTask(mCurrentProxy), TIMEUPDATE_PERIOD, TIMEUPDATE_PERIOD);

            if (mProgressView == null || mLayout == null) {
                return;
            }
            mTimer.schedule(new TimeupdateTask(mCurrentProxy), TIMEUPDATE_PERIOD, TIMEUPDATE_PERIOD);
            mProgressView.setVisibility(View.GONE);
            mLayout.removeView(mProgressView);
            mProgressView = null;