Skip to content Skip to sidebar Skip to footer

Android Mediaplayer Not Returning From Prepareasync

I'm getting the following back in Logcat starting MediaPlayer with a SPECIFIC URI. Normally every Uri, good or bad, will either play or come back with an error except this particul

Solution 1:

I thought It would be good If I share my implementation:

Try the following way of initialising your media player

try {
                    mMediaPlayer = new MediaPlayer();
                    mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
                    mMediaPlayer.setOnPreparedListener(this);
                    mMediaPlayer.setOnCompletionListener(this);
                    mMediaPlayer.setOnErrorListener(this);
                    mMediaPlayer.setOnBufferingUpdateListener(this);
                    mMediaPlayer.setOnInfoListener(this);
                    mMediaPlayer.setOnSeekCompleteListener(this);
                    mMediaPlayer.setDataSource(mContext, Uri.parse("http://54.196.206.122/entercom-koitfmaac-64"));
                    mMediaPlayer.prepareAsync();
                } catch (IOException e) {
                 // reset media player
                }

Mine onPrepared(MediaPlayer mp) is getting called after only a few seconds and it is playing your Music File.

Also FYI "Couldn't open file on client side, trying server side" is not an error message, but a debug message from the MediaPlayer. Logcat always says this when trying to play a network video stream.

Post a Comment for "Android Mediaplayer Not Returning From Prepareasync"