I'm developing a webradio player application on Android (API 17) and I'd like to play an audio flux from the Internet with the MediaPlayer Android library. This is my code:
String url = "http://stream.url.net/" ;
mediaPlayer.setDataSource(url);
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.prepareAsync();
And within an OnPreparedListener()
I launch the audio: mediaPlayer.start();
All goes well with this code on my old Android device (API 10).
However, when I launch it on my new Android device (API 17), the application is stuck on the prepareAsync()
and the player never appears. How can I fix this?