1. Android Central Question's Avatar
    This is the method where I create my Mediaplayer and set it's source, but directly after I call seekTo it does't play anymore (If I give it some time-depends on the audio, it worksm--> Conclusion after debug).

    public void makeAudio(boolean isInit){
    try{
    if(!isInit){
    mediaPlayer = new MediaPlayer();
    }
    soundSource = episode.getAudio();
    mediaPlayer.setDataSource(soundSource);
    mediaPlayer.prepareAsync();

    mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
    @override
    public void onPrepared(MediaPlayer mp) {
    soundLength = mediaPlayer.getDuration();
    seekBar.setMax(soundLength/1000);
    mediaPlayer.seekTo(progress);//the problem I guess
    }
    });

    }catch (Exception e){
    e.printStackTrace();
    }
    }
    It shows me this error message:

    E/MediaPlayerNative: Attempt to perform seekTo in wrong state: mPlayer=0x706c23ebc0, mCurrentState=0
    I would like to have any suggestion about this, because I want to make my mediaplayer go to the progress value(I get it from my intent).
    06-28-2021 05:28 AM
  2. B. Diddy's Avatar
    Welcome to Android Central! I moved this to the Software Development forum for more specific traffic.

    Please register on this forum, which will allow you to engage in discussion more easily, as well as post images. https://forums.androidcentral.com/as...community.html
    06-28-2021 01:03 PM

Similar Threads

  1. Google Assistant not Setting Reminders by Voice
    By KenWK in forum Ask a Question
    Replies: 16
    Last Post: 07-01-2021, 10:03 PM
  2. Trouble signing in due to unknown error after Factory reset
    By Android Central Question in forum Ask a Question
    Replies: 10
    Last Post: 06-28-2021, 12:43 PM
  3. Android phone track event
    By Android Central Question in forum Ask a Question
    Replies: 2
    Last Post: 06-28-2021, 01:38 AM
  4. Any way to make visited links a different color?
    By Android Central Question in forum Ask a Question
    Replies: 2
    Last Post: 06-27-2021, 09:00 PM
  5. Why are there two Facebook icons in my auto sync under the settings?
    By Android Central Question in forum Ask a Question
    Replies: 2
    Last Post: 06-27-2021, 05:52 PM
LINK TO POST COPIED TO CLIPBOARD