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

Commit a17b9b9f authored by Shalaj Jain's avatar Shalaj Jain Committed by Steve Kondik
Browse files

VideoView: Check state before calling suspend

Only call suspend under certain states. There is a possibility
that when activity is finished, pause gets called before destroy
calling suspend and stop on mediaplayer respectively. This will
result in stop failure as it has already been suspended.

CRs-Fixed: 750459
Change-Id: I34c24d6abe3726b163f9a582d73b31dfd4094e44
parent 2c364790
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -782,7 +782,8 @@ public class VideoView extends SurfaceView

    public void suspend() {
        // HTTP streaming will call MediaPlayer::suspend() for suspend operation, others will call release()
        if (isHTTPStreaming(mUri) && mCurrentState > STATE_PREPARING && mMediaPlayer != null) {
        if (isHTTPStreaming(mUri) && mCurrentState > STATE_PREPARING &&
                mCurrentState < STATE_PLAYBACK_COMPLETED && mMediaPlayer != null) {
            if (mMediaPlayer.suspend()) {
                mTargetState = mCurrentState;
                mCurrentState = STATE_SUSPENDED;