I'm developing an application that has one of the functions to play a streaming of a radio, the problem is that it worked in 1 Moto G2, 1 Moto G3 and in my ASUS Zenfone 2 LASER, it it just does not work it's like it does not support the protocol.
All handsets are in Android 6.0.1
String url = "http://104.247.207.42:8041/stream";
mp = new MediaPlayer();
mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
try {
mp.setDataSource(url);
mp.prepare();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
Log.e(TAG, "SecurityException");
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
Log.e(TAG, "IllegalStateException");
} catch (IOException e) {
// TODO Auto-generated catch block
Log.e(TAG, "IOException");
}
Code that prepares the player in onCreate()
, it plays in onStart()
of the service.
I wanted to know why it does not play, it does not return an error, and if I can use another lib without great difficulty replacing the Android MediaPlayer.