thanks for your help, i can play the mp3 file. Now I want to play from the http URL
below is my code 1:
Using java Syntax Highlighting
- MediaPlayer mp = new MediaPlayer();
- try {
- mp.setDataSource( "http://127.0.0.1/em_ringtone1.mp3" );
- if(mp!=null){
- mp.prepareAsync();
- mp.start();
- }
- } catch ( IOException e ) {
- Log.e( "ioexception", "", e);
- }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
code 2
Using java Syntax Highlighting
- MediaPlayer mp;
- Uri myUrl = Uri.parse("http://127.0.0.1/02.mp3");
- mp = MediaPlayer.create(mplayer.this,myUrl);
- if(mp!=null){
- mp.start();
- }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
====================
but i still can not play mp3 from the http URL.
could you please give me some suggestion ?
by the way, did anyone try the code from http://code.google.com/android/toolbox/apis/media.html ?
====================
Using java Syntax Highlighting
- Playing Media via URL
- Uri myUrl = Uri.parse("http://myserver.com/link/to/my.mp3");
- Intent intent = new Intent(Intent.VIEW_ACTION, myUrl);
- intent.setType("audio/*");
- startActivity(intent);
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
====================
i try it, but it failed in startActivity(intent); ?
thank you very much !





