I am trying to create an audio stream with Android MediaPlayer. This is normal if it does not work with Android 2.1 or lower. I need to be able to play audio from a SHOUTcast stream. Here is my code:
player = new MediaPlayer(); try { player.setDataSource("http://87.230.103.107:8000"); player.prepareAsync(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } player.start();
For some reason, this code will only play nothing. I think this may be due to application permissions. Does anyone know what is going on?
Thanks!
[UPDATE] I get the following errors:
04-25 23:35:15.432: ERROR/MediaPlayer(283): start called in state 4 04-25 23:35:15.432: ERROR/MediaPlayer(283): error (-38, 0) 04-25 23:35:15.602: ERROR/MediaPlayer(283): Error (-38,0) 04-25 23:35:17.542: INFO/AwesomePlayer(33): calling prefetcher->prepare() 04-25 23:35:18.547: INFO/Prefetcher(33): [0x17650] cache below low water mark, filling cache. 04-25 23:35:18.762: INFO/AwesomePlayer(33): prefetcher is done preparing 04-25 23:35:19.769: ERROR/AwesomePlayer(33): Not sending buffering status because duration is unknown.
source share