开发者

Android: URL for playing music via HTTP streaming

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜