Android MediaPlayer error: MediaPlayer error (1, -2147483648) on a stream from the Internet

I am trying to transfer audio from a URL. The code works fine with other URLs, but in one of them it does not work in the method OnPrepared, returning this error code: (1, -2147483648). I read some people saying this because of permissions, but this is a remote file, so I cannot set permissions. I tried the url with other apps like VLC and iTunes and it works great. My code is here:

private void prepareradio() {
    player = new MediaPlayer();
    player.setAudioStreamType(MODE_WORLD_READABLE);
    try {
        player.setDataSource(url);

    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (IllegalStateException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    player.setOnErrorListener(new OnErrorListener(){
        public boolean onError(MediaPlayer arg0, int arg1, int arg2) {
            Toast.makeText(getApplicationContext(),"An error happened while preparing radio",Toast.LENGTH_LONG).show();
            prepareradio();
            playe.setEnabled(true);
            hidenot();
            return false;
        }
    });
+4
source share
3 answers

If you are testing devices earlier than Android 3.1, you may not be able to play AACP (as shown on the stream stream information page (AAC +).

Information page for your stream:
enter image description here

, , : http://developer.android.com/reference/android/media/AudioManager.html

, aacp checkout :
fooobar.com/questions/61646/...

+2

Froyo Gingerbread. . , , Https Url Http Url & ; . . S3, "https" url "http" .

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

PS: , H.264, , .

+3

As I see, this stream is not supported by mediaPlayer. Android supports AAC LC / LTP, but your stream is aacp. I think this may be the main cause of your problem.

0
source

All Articles