try this example for streaming RTSP (the URL must support RTSP) to change the video code to support only audio
public class MultimediaActivity extends Activity { private static final String RTSP = "rtsp://url here"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.multimedia);
EDIT:
Direct audio transfer using MediaPlayer in Android Direct audio transfer in Android and from 1.6 sdk onward has become so simple. The setDataSource () API directly passes the URL and the sound will play without any problems.
Full snippet of code
public class AudioStream extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String url = "http://www.songblasts.com/songs/hindi/t/three-idiots/01-Aal_Izz_Well-(SongsBlasts.Com).mp3"; MediaPlayer mp = new MediaPlayer(); try { mp.setDataSource(url); mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.prepare(); mp.start(); } catch (Exception e) { Log.i("Exception", "Exception in streaming mediaplayer e = " + e); } } }
Athul harikumar
source share