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

  • Home
  • SEARCH
  • 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 7016657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:48:50+00:00 2026-05-27T22:48:50+00:00

everytime I start my stream, I get two MediaPlayer Errors. 01-03 12:04:35.738: D/PlayerActivity(10164): play

  • 0

everytime I start my stream, I get two MediaPlayer Errors.

01-03 12:04:35.738: D/PlayerActivity(10164): play
01-03
12:04:35.742: D/PlayerService(10164): setAudiotStreamType
01-03
12:04:35.742: D/PlayerService(10164): setDataSource
01-03
12:04:35.742: D/PlayerService(10164): prepareAsync
01-03
12:04:35.742: E/MediaPlayer(10164): start called in state 4
01-03
12:04:35.742: E/MediaPlayer(10164): error (-38, 0)
01-03
12:04:35.742: D/PlayerService(10164): onPrepared
01-03
12:04:35.742: D/PlayerService(10164): onCreate Service
01-03
12:04:35.750: E/MediaPlayer(10164): Error (-38,0)
01-03
12:04:38.261: D/PlayerService(10164): onPrepared

At the Debug Tag “play”, I clicked the play button.
Than my “onCreate” in the MediaPlayer service is called which executes “setAudioStreamTpe”, “setDataSource”, “prepareAsync”, and then onPrepared(myMediaPlayer).
OnPrepared only executes mp.start(). After that “onPrepared” is logged. And then, at the end of the “onCreate” from my service, “onCreate Service” is logged.

Why are there 2 onPrepared?! With mp.prepare() i got no errors.

The Code:

    @Override
public void onCreate() {
    mp = new MediaPlayer();
    mp.setOnPreparedListener(this);
    prepareMediaPlayer();
    onPrepared(mp);
    Log.d(TAG, "onCreate Service");
}


    public void prepareMediaPlayer()
{
    try {
        mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
        Log.d(TAG, "setAudiotStreamType");
        mp.setDataSource(PlayerActivity.soundUrl); 
        Log.d(TAG, "setDataSource");
        mp.prepareAsync();
        Log.d(TAG, "prepareAsync");

    } 
    catch (IOException e) {}
    catch (IllegalArgumentException e) {} 
    catch (IllegalStateException e) {}

}


    @Override
public void onPrepared(MediaPlayer mp) {
    mp.start();
    if (PlayerService.mp.isPlaying() == true){
        notification();
        PlayerActivity.mpState = PlayerActivity.PLAYING;
    }
    Log.d(TAG, "onPrepared");
}
  • 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-27T22:48:51+00:00Added an answer on May 27, 2026 at 10:48 pm

    You should not call onPrepared(mp); in onCreate(), it will be called once the MediaPlayer is ready.

    public void onCreate() {
        mp = new MediaPlayer();
        mp.setOnPreparedListener(this);
        prepareMediaPlayer();
        Log.d(TAG, "onCreate Service");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On Google App Engine I get multiple java.lang.reflect.InvocationTargetException everytime I start the development server.
I am using xcode with emacs. But everytime I start emacs, I need to
Everytime my app start I have it check if there has been any changes
Everytime I start a project I have to think carefully about which files to
I just install auto-complete-mode, however everytime I start emacs I have to M-x auto-complete-mode.
I want to enable line-wrapping without having to type 'M-x auto-fill-mode' everytime I start
My [NSUserDefaults standardUserDefaults] are not being saved. Everytime I close the app and start
Instead of doing the following everytime start(); // some code here stop(); I would
after starting intellij idea I get everytime the message: Load error: undefined path variables!.
Every time I start Emacs I see a page of help text and a

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.