MediaPlayer的,唯一的视频M3U8 HTTML流工作 [英] MediaPlayer, only video m3u8 HTTML streams work
问题描述
我用MediaPlayer的一个M3U8音频流。这将导致日志错误消息:错误(1,1010)
I'm using the MediaPlayer with a m3u8 audio stream. This results in a log error message: Error(1, -1010)
第一个参数似乎确定当我在看错误codeS:<一href=\"https://github.com/android/platform_external_opencore/blob/master/pvmi/pvmf/include/pvmf_return_$c$cs.h\" rel=\"nofollow\">https://github.com/android/platform_external_opencore/blob/master/pvmi/pvmf/include/pvmf_return_$c$cs.h
The first argument seems ok when I look at the error codes: https://github.com/android/platform_external_opencore/blob/master/pvmi/pvmf/include/pvmf_return_codes.h
只有 -1010
,很奇怪。
当我使用苹果视频 M3U8
URL它的工作太棒了!这是网址:
http://devimages.apple.com/iphone/samples/bipbop/gear1 /prog_index.m3u8
When I use the apple video m3u8
url it's working great! This is the url:
http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8
在code我使用的是简单的:
The code I'm using is simple:
MediaPlayer mediaPlayer = new MediaPlayer();
try {
mediaPlayer.setDataSource("http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8");
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.prepare();
mediaPlayer.setOnPreparedListener(this);
mediaPlayer.setOnErrorListener(this);
mediaPlayer.setOnCompletionListener(this);
mediaPlayer.start();
} catch (IllegalArgumentException e1) {
e1.printStackTrace();
} catch (IllegalStateException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
有谁知道是否有音频流只有一个限制?我用多种格式和不同的扩展。
Does anyone know if there is a limitation for audio only streams? I used multiple formats and different extensions.
其他的问题:有没有人有一个M3U8音频流的URL,这样我就可以测试其他流
Other question: does anyone have an URL of an m3u8 audio stream, so I can test other streams?
推荐答案
我目前连接到一个项目解决这个主题。
现在我知道这并没有真正回答你的问题,但只是为了见识,即使是在Android 4.0以上版本支持M3U8参差不齐是最好,在最坏的情况太可怕了。
I'm currently attached to a project tackling this very subject. Now I know this doesn't really answer your question, but just for insight, even on Android 4.0+ M3U8 support is spotty at best, awful at worst.
例如:
- 的Nexus 7 Akmai失败,工作在USTREAM
- DROID RAZR的作品上都Akmai和USTREAM。
现在通过短类扩展修补库(并具有每其他Android次版本。这样的),我们没有发现任何SDK / NDK,唯一的解决办法的;我们放弃了一个月的试错之后在我们的项目(成本太高)。
Now short of patching the libraries via class extension (and having .so's for every other android minor version) we found no SDK/NDK-only solution; we gave up after a month of trial and error on our project (too costly).
我们实现的解决方案是:尝试SDK的MediaPlayer。如果失败使用基于FFMPEG播放器(内部开发,利用dranger,ffplay,Android的fplayer和海豚球员为灵感)。
The solution we implemented was: Try the SDK MediaPlayer. If that fails use a FFMPEG based player (developed in-house, using dranger, ffplay, android-fplayer and dolphin-player as inspiration).
这篇关于MediaPlayer的,唯一的视频M3U8 HTTML流工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!