Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6199059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:07:26+00:00 2026-05-24T04:07:26+00:00

I wrote a small music playback control test application. I have a play, pause,

  • 0

I wrote a small music playback control test application. I have a play, pause, stop and rewind button. My issue is that that
player.stop();
is behaving the same exact way as
player.pause();
I am calling player.prepare() right after player.stop() so that i can have the player instance ready for start() operation.

I do not see any errors [IOexceptions or IllegalStateExceptions] being raised while calling the prepare() after i do a stop(). Also, i am not calling any seekTo(0) after stop(). So, i am not setting the position back to the beginning of the song.

I am using a Nexus Google One phone running 2.3.4.

Any idea if i am doing something stupid or if what i am observing is actually how the state machine was built.

TIA.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:07:27+00:00Added an answer on May 24, 2026 at 4:07 am

    doesn’t the state diagram http://developer.android.com/reference/android/media/MediaPlayer.html
    states that stop means "stay in stopped state" ?

    Calling stop() stops playback and causes a MediaPlayer in the Started, Paused, Prepared or PlaybackCompleted state to enter the Stopped state.

    Once in the Stopped state, playback cannot be started until prepare() or prepareAsync() are called to set the MediaPlayer object to the Prepared state again.
    Calling stop() has no effect on a MediaPlayer object that is already in the Stopped state.

    There’s no affirmation that stop() should change the CurrentPosition.

    There’s no affirmation that calling the prepare() should change the CurrentPosition.

    So, to go to the beginning of the music, you should mannualy set its position.

    But I agree with you. Since the pause() method states it will resume playing from the current position, I’d expect it get back to the beginning when stop() is called.

    And it has some impact when you need to call the prepare()

    For example, the call to prepare() can take a long time to execute, because it might involve fetching and decoding media data.

    so stop() needs to call prepare() that can make it take longer, while pause() has less impact: you can call the start() right after.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a small WinForms application in C# with Visual Studio 2010. It worked
I wrote a small queue class in C++, on Windows. Just to test, I'm
I am trying to write a small music manager in Linux using C++. I
I wrote small 'News Ticker'. I should make a loop through the spans ,
I wrote a small servlet and jsp project on eclipse and tomcat 5.5 ,
I wrote a small Server class which basically is a TcpListener wrapper and ThreadPool
I wrote a small script to let a label move out of the way
I wrote a small program in C# NET a while back to keep a
I have a large list of entities which the user needs to be able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.