I want to play online radio in android application? It can be done RTMP. But i am not aware how to move ahead. Can some one throw light on this?
i am able to play static mp3 file here s below working code:
package org.example.video;
import android.view.KeyEvent;
import android.view.View;
import android.widget.VideoView;
import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.widget.VideoView;
import android.media.*;
public class Video extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.lay开发者_如何学Goout.main);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
Context appContext = getApplicationContext();
MediaPlayer urlPlayer = MediaPlayer.create(appContext,
Uri.parse("http://naachradio.com/data/addSound.mp3"));
urlPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
// urlPlayer.prepare();
urlPlayer.start();
}
}
精彩评论