Audio-Streaming IOException: Prepare failed.: status=0xFFFFFFF6 - android

Android 2.3 Mediaplayer can't play none of those audiostreams resulting in W/System.err(19610): java.io.IOException: Prepare failed.: status=0xFFFFFFF6. However, the same stream works fine on Android 4.0.
Is there anything I can provide the app with to make it work on Android 2.3 platform ?
Thanks.
Some code that I use:
mPlayer = new MediaPlayer();
mPlayer.setOnErrorListener(mOnErrorListener);
mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mPlayer.setOnPreparedListener(mOnPreparedListener);
mPlayer.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
try {
mPlayer.setDataSource(
this,
Uri.parse("http://radio02-cn03.akadostream.ru:8114/detifm192.mp3"));
mPlayer.prepare();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
UPD
I'm able to play "http://radio02-cn03.akadostream.ru:8114/detifm192.mp3" with MoboPlayer - any suggestions how they do it ? It plays after message "trying soft decoding mode"

Check there encoding. It seems that hardware decoding is failing.

Related

Android: Redirecting pls file so that mediaplayer can read it

I want to play a radio shoutcast but its a pls file format by looking at the link:
http://yp.shoutcast.com/sbin/tunein-station.pls?id=13361 It doesn't play at the moment,
I have got:
Initializing:
player = new MediaPlayer();
try {
player.setDataSource("http://yp.shoutcast.com/sbin/tunein-station.pls?id=13361");
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
When play button is pressed:
player.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
player.start();
}
});
I have the code tested with another shoutcast link that ends with a port like www.example.com:8080 or something like that, it was working pretty fine, but when the link changed to a pls?id= it doesn't read the link and hence I can't hear the radio... Someone please help me with this :-/
A .pls file is just a playlist. There is no media there. You will have the parse the file yourself to get the actual stream URLs. Open it up in a text editor to see what I mean.

Getting a syntax error that I can't fix

I am using the following code to try and catch all the errors that can occur for an audioPlayer. However, the very last brace creates a syntax error. Can anyone tell me why?
It says: "Syntax Error, insert '}' to complete ClassBody"
Code:
public void audioPlayer(String path, String fileName){
//set up MediaPlayer
MediaPlayer mp = new MediaPlayer();
try {
mp.setDataSource(path+"/"+fileName);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
mp.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mp.start();
}
This bug have been fixed by the ADT team : http://code.google.com/p/android/issues/detail?id=33985
It should be released soon.
Cleaning the project solve the problem actually.
mp.start() can throw an IllegalStateException that you are not catching or allowing to be thrown.
According to: http://developer.android.com/reference/android/media/MediaPlayer.html#start%28%29

Using eclipse streaming audio from web url

I have tried to find the answer online and none are clear to me. I am starting of programming and dont know much so any assistance that makes sense would help. My brother developed a website I'm trying to stream audio from and found on the developer web page a code to use. eclipse gives me no errors but when I run the app it forces close here is my code:
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
String url = "http://beatswith.us/uploads/Mac%20Miller%20- %20Paper%20Route%20feat.%20Kev%20Da%20Hustla.mp3"; // your URL here
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
try {
mediaPlayer.setDataSource(url);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
mediaPlayer.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // might take long! (for buffering, etc)
mediaPlayer.start();
}
};
Its probably throwing an exception at mediaPlayer.start()
The url must be bad. looks to me like theres an actual space in your String, which is invalid. You should put setDataSource, prepare, and start in the same try/catch block
Edit:nevermind the url seems fine. Can you post the stacktrace of the exception?
Edit2: did you add your activity to the AndroidManifest.xml? Are you navigating here from another activity?
Found the Answer I had my button set up with the wrong package name

RTSP streaming doesn't work

I've created an app which will play from on RTSP:
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
try
{
mediaPlayer.setDataSource(
"rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov");
mediaPlayer.prepare();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
//e.printStackTrace();
Toast.makeText(MyYouTubeActivity.this,
"Eror Play", Toast.LENGTH_SHORT).show();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mediaPlayer.start();
But it's not working, in Logcat I see this:
09-12 12:57:20.899: ERROR/PlayerDriver(95): Command PLAYER_PREPARE completed with an error or info PVMFFailure
First inset permission ::
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.INTERNET
code ::
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
player.setDataSource("url");
player.prepare();
player.start();
and also refer :: This

Playing Audio file

I use the following code to play audio from sdcard. But it doesn't play, even doesn't throw error. My file is in the following path /sdcard/media/blueeye.mp3. Any suggestions.
public void audioPlayer(){
//set up MediaPlayer
MediaPlayer mp = new MediaPlayer();
try {
mp.setDataSource(mp.setDataSource(getExternalFilesDir() + "/media/blueeye.mp3"); );
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
mp.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mp.start();
}
I think it should be /mnt/sdcard/media/blueeye.mp3 and please use getExternalFilesDir():
mp.setDataSource(getExternalFilesDir() + "/media/blueeye.mp3");
Also, If you'd set your own onErrorListener, you will be able to see easily what the problem is.

Categories

Resources