unable to stream 3gp or m4a audio files using mediaplayer

All your problems with Audio, Video and Images.

unable to stream 3gp or m4a audio files using mediaplayer

Postby enlightened » Wed Feb 16, 2011 9:04 pm

hey guys, i am recording audio files in my android app (i can either do 3gp or m4a format) but once i upload them onto my remote web server i can't stream them back in my app using the code below. i tried using prepare() as well as prepareAsync() with the setOnErrorListener() but it still doesnt work. if i place an MP3 file in the same remote location my app streams it without any problems. is there a problem with streaming of 3gp or m4a files on 2.2+ ? or perhaps i should use another way?

thanks!

Code: Select all
MediaPlayer mp = new MediaPlayer();     

mp.setDataSource("http://XXXXXXX/test.3gp");
mp.prepareAsync();
mp.setOnErrorListener(new OnErrorListener() {
  public boolean onError(MediaPlayer arg0, int arg1, int arg2) {
    Toast.makeText(send_voice.this, "error:" + arg2, Toast.LENGTH_SHORT).show();
    return false;
  }             
});
mp.setOnPreparedListener(new OnPreparedListener() {
  public void onPrepared(MediaPlayer mpx) {
    mpx.start();
    Toast.makeText(send_voice.this, "play", Toast.LENGTH_SHORT).show();
  }
});
enlightened
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Feb 16, 2011 9:02 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Google Feedfetcher and 19 guests