6

I get this error when playing a streaming audio in Android:

MediaPlayer(658): error (1, -2147483648)

mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(url);
mediaPlayer.prepareAsync();
dda
  • 6,030
  • 2
  • 25
  • 34
Sreekumar Menon
  • 63
  • 1
  • 1
  • 3
  • I'm having an issue getting this error too. I have not been able to find the cause yet. In my case I have a service that streams music from a url. I can run the service from one activity just fine. However when I run it from another activity it always gives me this error. Same url, same code. Driving me crazy! The activity that causes the problem is a fairly complex activity and I am wondering if it has to do with memory. Still working this one! – Patrick Jackson Dec 31 '11 at 01:49

4 Answers4

4

I don't know about playing streams but I was getting the same error from trying to play a file residing on the device. The solution was that the MediaPlayer didn't have the right permissions to read the video file. This article helped me out tremendously. http://www.weston-fl.com/blog/?p=2988

cnowacek
  • 73
  • 8
  • Thanks for the link! Been banging my head against this error (1, -2147483648) for the past 2 hours. The problem turned out to be permission to the video file I was trying to play as the article pointed out. My videoFile was in the context.getCacheDir() which is not readable by the MediaPlayer. Changing my file to be stored in context.getExternalCacheDir() fixed it right up! – Akos Cz Mar 20 '12 at 11:55
  • 1
    The link is dead. [Read up on link-only or link-heavy answer](http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers). – gunr2171 Mar 06 '15 at 17:30
2

I was also getting the same error on Froyo & Gingerbread. In higher Androids the same video played well. Finally after a lot of research, tried changing the Https Url to Http Url & Bingo. It resolved my issue. I was using amazon S3 server so that simply replacing the "https" in url with "http" was sufficient.

  videoUrl= videoUrl.replaceFirst("https", "http"); 

PS: For supporting older versions if you are using H.264 make sure videos are Baseline encoded.

Ajith M A
  • 3,838
  • 3
  • 32
  • 55
0

After many try/error tests, for me has worked using full path on "new Media(...)", like this:

var mySound = new Media('file:///android_asset/www/sound/mysound.mp3');

S.

0

From the information you provided it is not possible to tell what is wrong exactly. You use prepareAsync() method, have you registered onPreparedListener? The prepareAsync method returns immediately, without onPreparedListener you do not have information when it is ready to start playing.

The other possibility is an error in your URL, or unsupported streaming protocol...

vitakot
  • 3,786
  • 4
  • 27
  • 59