5

是否有人在 android 设备上运行 http live Streaming(由 Apple 发现)。我有一些流媒体网址。像 "" www.abc/iphone/france24/allegro/fr/f24_fr.m3u8 "" 类型。我的任务是为 android 3.0 OS 类型的移动设备制作应用程序。任何人都可以帮我完成它。

该主题是android市场中的新主题。因此互联网上没有太多帮助。我有一个示例代码可以在 android 设备上运行直播。但它没有运行我拥有的 url。这些 url 在 IPAD 或 IPHONE 上有效。谢谢

4

1 回答 1

2

查看 android 错误报告中的问题。用 httplive 替换 http 对我有用。以下是错误报告中的示例代码

private void playVideo(Integer Media) {
    doCleanUp();
    try {
        switch (Media) {
            case Globals.TEST_HTTP:
                path = "http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8";
                break;
            case Globals.TEST_HTTPLIVE:
                path = "httplive://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8";
                break;
        }
        mMediaPlayer = new MediaPlayer();
        mMediaPlayer.setDataSource(path);
        mMediaPlayer.setDisplay(holder);
        mMediaPlayer.prepare();
        mMediaPlayer.setOnBufferingUpdateListener(this);
        mMediaPlayer.setOnCompletionListener(this);
        mMediaPlayer.setOnPreparedListener(this);
        mMediaPlayer.setOnVideoSizeChangedListener(this);
        mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    } catch (Exception e) {
        Log.e(TAG, "error: " + e.getMessage(), e);
    }
}
于 2013-02-06T21:18:02.070 回答