I write Android app and I want to playing music from a remote URL via HTTP streaming. In official tu开发者_C百科ttorial is showed this code:
String url = "http://........"; // your URL here
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(url);
mediaPlayer.prepare(); // might take long! (for buffering, etc)
mediaPlayer.start();
But I don't know what kind of URL I should use. Can you show me example of URL that I should use for playing music via HTTP streaming?
It's an URL, simply an URL. Something like "http://www.adomain.com/music/The%20music.mp3".
And change prepare() to prepareAsync() because this might take long.
精彩评论