I am using Android MediaPlayer to play a stream on my device, but I get an error message while playing a stream.
I use VLC on my PC to transfer audio to my device. With the VLC version for Android, I can play sound on my device, so my streaming is fine.
Here is my code:
try { player = new MediaPlayer(); player.setAudioStreamType(AudioManager.STREAM_MUSIC); player.setDataSource("http://192.168.3.111:8080/xx"); //player.setSurface(null); //player.prepare(); player.prepareAsync(); //player.start(); player.setOnPreparedListener(new OnPreparedListener() { public void onPrepared(MediaPlayer mp) { player.start(); } }); player.setOnErrorListener(new OnErrorListener() { @Override public boolean onError(MediaPlayer mp, int what, int extra) { Log.e("RTP", "ERROR: " + what + " " + extra); return false; } }); } catch (Exception e) { Log.d("RTP", e.getMessage()); }
Every time I get the following error: error (1, -2147483648)
I tried RTP, RTSP, HTTP and always the same result.
Update1: Is this a codec problem? I play mp3 without transcoding.
source share