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

Commit 3ca04b63 authored by Avss, Srikanth's avatar Avss, Srikanth Committed by Steve Kondik
Browse files

frameworks/base: Resume playback after MT call with single seek

Allowing Seek only after the player is in Prepared state leads to
setting playback position to the beginning of the clip  and then seeking
to the desired location.changes made to allow Seek even in Initialized state.

CRs-Fixed: 194319
parent 6661234d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -213,6 +213,10 @@ public class VideoView extends SurfaceView implements MediaPlayerControl {
            mMediaPlayer.setDisplay(mSurfaceHolder);
            mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
            mMediaPlayer.setScreenOnWhilePlaying(true);
            if (mSeekWhenPrepared != 0) {
                mMediaPlayer.seekTo(mSeekWhenPrepared);
                mSeekWhenPrepared = 0;
            }
            mMediaPlayer.prepareAsync();
            // we don't set the target state here either, but preserve the
            // target state that was there before.
+1 −1
Original line number Diff line number Diff line
@@ -428,7 +428,7 @@ status_t MediaPlayer::getDuration(int *msec)
status_t MediaPlayer::seekTo_l(int msec)
{
    LOGV("seekTo %d", msec);
    if ((mPlayer != 0) && ( mCurrentState & ( MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_PAUSED |  MEDIA_PLAYER_PLAYBACK_COMPLETE) ) ) {
    if ((mPlayer != 0) && ( mCurrentState & ( MEDIA_PLAYER_INITIALIZED | MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_PAUSED |  MEDIA_PLAYER_PLAYBACK_COMPLETE) ) ) {
        if ( msec < 0 ) {
            LOGW("Attempt to seek to invalid position: %d", msec);
            msec = 0;