Do I want to play online radio in an Android app? This can be done by RTMP. But I do not know how to move on. Can someone shed some light on this?
I can play a static mp3 file here below is the 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 {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.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.start();
}
}
source
share