How to use android media player play radio streaming in asx format -
i want play streaming url:
http://www.mediacorpradio.sg/radioliveplayer/asx/class95/fm950.asx
what tried:
public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); ... // player player = new mediaplayer(); player.setaudiostreamtype(audiomanager.stream_music); player.setonpreparedlistener(new onpreparedlistener() { public void onprepared(mediaplayer mp) { mp.start(); button.setimageresource(r.drawable.pause); } }); try { player.setdatasource(radio_url); } catch (exception e) { toast("unable play radio. please email if see constantly."); return; } player.prepareasync(); } private void togglestate(){ if (player.isplaying()) { player.pause(); button.setimageresource(r.drawable.play); }else{ player.prepareasync(); } } @override public void ondestroy() { super.ondestroy(); player.release(); }
error get: (1, -1004)
Comments
Post a Comment