MediaPlayer Error

All your problems with Audio, Video and Images.

MediaPlayer Error

Postby asolanki » Tue Aug 18, 2009 11:26 am

HI all!!
i am trying audio streaming from the remote server. my code is as below

MediaPlayer player = new MediaPlayer();
player.setDataSource(url);
player.prepareAsync();

public void onPrepared(MediaPlayer mp) {
Log.e("ONPREPARED",".........");
player.start();

}

public boolean onError(MediaPlayer arg0, int what, int extra) {


return true;
}



i am getting error MediaPlayer Error :(-1,0)


please anyone can help me to understand the meaning of (-1,0)

thatnks in andvance
asolanki
Senior Developer
Senior Developer
 
Posts: 151
Joined: Thu Jan 08, 2009 7:32 am

Top

Postby Luki » Wed Aug 19, 2009 3:32 pm

Unfortunately this error does not have much semantic. It's more like a general error. What type of file do you try to play? MP3? If you can, post the link to the file here.

Cheers
Luki
Developer
Developer
 
Posts: 32
Joined: Fri Jul 24, 2009 12:59 pm

Postby AndSmash » Thu Sep 03, 2009 7:57 am

Are you supplying a direct url to the file? i.e. http://www.whatever.com/musicdir/music.mp3

In my past experience with MediaPlayer, if you don't pass a direct url to the music file the player won't accept it. If it's not a direct URL you may have to read it as a stream.
AndSmash
Freshman
Freshman
 
Posts: 4
Joined: Sat Aug 08, 2009 5:51 am

Postby Luki » Sun Sep 06, 2009 4:26 pm

@AndSmash: What do you mean by not passing a direct URL to the media player? A relative file path to a file on the phone?
Luki
Developer
Developer
 
Posts: 32
Joined: Fri Jul 24, 2009 12:59 pm

Postby Shanytc » Sun Sep 06, 2009 5:02 pm

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. mediaPlayer.setDataSource(url);
  3.  
  4. mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
  5.  
  6. mediaPlayer.prepare();
  7.  
  8. mediaPlayer.start();
  9.  
  10.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
- Shany -
Shanytc
Junior Developer
Junior Developer
 
Posts: 17
Joined: Fri Aug 14, 2009 11:00 am

Postby AndSmash » Sun Sep 06, 2009 8:44 pm

Luki wrote:@AndSmash: What do you mean by not passing a direct URL to the media player? A relative file path to a file on the phone?


A direct URL has the extension on the end of it, i.e. .mp3 or .wav
AndSmash
Freshman
Freshman
 
Posts: 4
Joined: Sat Aug 08, 2009 5:51 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 10 guests