1

我在网络上有在线广播(大喊大叫)。我想开发 android 应用程序来收听这个流。所以我想知道如何在android中播放在线流。使用网址。在 Android 中,我不会流式传输音频。我想听来自 android 应用程序的网络流。怎么做..?谢谢

4

2 回答 2

4

就像是

private void init() throws IOException {
    try {
        mediaPlayer = new MediaPlayer();
        String streamPath = "";//enter path
        mediaPlayer.setDataSource(streamPath);
        mediaPlayer.prepare();
    } catch (MalformedURLException ex) {
        throw new RuntimeException("Wrong url for mediaplayer! " + ex);
    } catch (IllegalStateException ex) {
    } catch (IllegalArgumentException ex) {
        throw new RuntimeException("Wrong url for mediaplayer! " + ex);
    }
}

private void play() {
    mediaPlayer.start();
}
于 2011-08-29T18:52:48.380 回答
1

请参考它可能对您有帮助的链接,http://developer.android.com/guide/topics/media/index.html

于 2011-08-29T18:48:10.127 回答