我有一个使用H.264基线编码的Mandbrake转换的MP4文件。这流在浏览器中正常。
我创建了一个可以在视频中流式传输此视频的应用程序。我已经在4.0.1和4.3中进行了测试,而且效果很好。该视频播放很好。
使用2.3.3 Android模拟器,我可以听到声音,但没有视频。当我在实际的2.3.3设备(HTC EVO)中尝试它时,它根本无法播放视频。我得到了一个"无法播放的视频"错误。我不太确定是否在姜饼中得到支持,但是似乎是如此,因为仿真器至少可以播放音频。
我在logcat中看到了一些HDMI权限信息,但我不确定这是什么意思。感谢任何反馈。谢谢!
这是logcat:
01-29 18:42:19.775: D/@@@@(1297): GameDetailFragment onPause
01-29 18:42:20.116: V/MediaPlayer(1297): constructor E
01-29 18:42:20.116: I/AudioSystem(1297): getting audio flinger
01-29 18:42:20.116: I/AudioSystem(1297): returning new audio session id
01-29 18:42:20.116: V/MediaPlayer(1297): constructor X
01-29 18:42:20.116: V/MediaPlayer(1297): setListener
01-29 18:42:20.116: D/MediaPlayer(1297): hasHDMIPermission: -1
01-29 18:42:20.116: D/MediaPlayer(1297): registerHDMINotification
01-29 18:42:20.116: E/HDMIStatusObserver(1297): status: UNPLUG
01-29 18:42:20.116: D/MediaPlayer(1297): isHDMIPlug(): false
01-29 18:42:20.126: E/MediaPlayer(1297): onHDMIStateChanged
01-29 18:42:20.126: E/MediaPlayer(1297): hdmi_setting not found!
01-29 18:42:20.126: W/System.err(1297): java.io.FileNotFoundException: /data/hdmi_setting (No such file or directory)
01-29 18:42:20.126: W/System.err(1297): at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
01-29 18:42:20.126: W/System.err(1297): at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)
01-29 18:42:20.126: W/System.err(1297): at java.io.FileInputStream.<init>(FileInputStream.java:80)
01-29 18:42:20.126: W/System.err(1297): at java.io.FileInputStream.<init>(FileInputStream.java:132)
01-29 18:42:20.126: W/System.err(1297): at java.io.FileReader.<init>(FileReader.java:66)
01-29 18:42:20.126: W/System.err(1297): at android.media.MediaPlayer.readHDMISetting(MediaPlayer.java:2245)
01-29 18:42:20.126: W/System.err(1297): at android.media.MediaPlayer.getHDMIResolution(MediaPlayer.java:2124)
01-29 18:42:20.126: W/System.err(1297): at android.media.MediaPlayer.<init>(MediaPlayer.java:564)
01-29 18:42:20.126: W/System.err(1297): at android.widget.VideoView.openVideo(VideoView.java:217)
01-29 18:42:20.126: W/System.err(1297): at android.widget.VideoView.access$2000(VideoView.java:49)
01-29 18:42:20.126: W/System.err(1297): at android.widget.VideoView$6.surfaceCreated(VideoView.java:482)
01-29 18:42:20.126: W/System.err(1297): at android.view.SurfaceView.updateWindow(SurfaceView.java:551)
01-29 18:42:20.126: W/System.err(1297): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:348)
01-29 18:42:20.126: W/System.err(1297): at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
01-29 18:42:20.126: W/System.err(1297): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
01-29 18:42:20.126: W/System.err(1297): at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
01-29 18:42:20.126: W/System.err(1297): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
01-29 18:42:20.126: W/System.err(1297): at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
01-29 18:42:20.126: W/System.err(1297): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
01-29 18:42:20.126: W/System.err(1297): at android.view.View.draw(View.java:6973)
01-29 18:42:20.126: W/System.err(1297): at android.widget.FrameLayout.draw(FrameLayout.java:357)
01-29 18:42:20.126: W/System.err(1297): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1961)
01-29 18:42:20.126: W/System.err(1297): at android.view.ViewRoot.draw(ViewRoot.java:1600)
01-29 18:42:20.126: W/System.err(1297): at android.view.ViewRoot.performTraversals(ViewRoot.java:1321)
01-29 18:42:20.126: W/System.err(1297): at android.view.ViewRoot.handleMessage(ViewRoot.java:1957)
01-29 18:42:20.126: W/System.err(1297): at android.os.Handler.dispatchMessage(Handler.java:99)
01-29 18:42:20.136: W/System.err(1297): at android.os.Looper.loop(Looper.java:143)
01-29 18:42:20.136: W/System.err(1297): at android.app.ActivityThread.main(ActivityThread.java:4263)
01-29 18:42:20.136: W/System.err(1297): at java.lang.reflect.Method.invokeNative(Native Method)
01-29 18:42:20.136: W/System.err(1297): at java.lang.reflect.Method.invoke(Method.java:507)
01-29 18:42:20.136: W/System.err(1297): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-29 18:42:20.136: W/System.err(1297): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-29 18:42:20.136: W/System.err(1297): at dalvik.system.NativeStart.main(Native Method)
01-29 18:42:20.136: D/MediaPlayer(1297): getHDMIResolution: 00
01-29 18:42:20.136: D/MediaPlayer(1297): setDataSource(Context context, /, Map<String, String> headers) in
01-29 18:42:20.136: V/MediaPlayer(1297): setDataSource(/)
01-29 18:42:20.136: D/MediaPlayer(1297): setDataSource(Context context, /, Map<String, String> headers) out, scheme == null || scheme.equals(file)
01-29 18:42:20.136: V/MediaPlayer(1297): setVideoSurface
01-29 18:42:20.136: V/MediaPlayer(1297): MediaPlayer::setAudioStreamType
01-29 18:42:20.136: V/MediaPlayer(1297): setVideoSurface
01-29 18:42:20.136: V/MediaPlayer(1297): prepareAsync
01-29 18:42:20.146: V/MediaPlayer(1297): message received msg=100, ext1=1, ext2=-2147483648
01-29 18:42:20.146: E/MediaPlayer(1297): error (1, -2147483648)
01-29 18:42:20.146: V/MediaPlayer(1297): callback application
01-29 18:42:20.146: V/MediaPlayer(1297): back from callback
01-29 18:42:20.156: E/MediaPlayer(1297): Error (1,-2147483648)
01-29 18:42:20.156: D/VideoView(1297): Error: 1,-2147483648
01-29 18:42:21.307: D/MediaPlayer(1297): reset() in
01-29 18:42:21.307: V/MediaPlayer(1297): reset
01-29 18:42:21.307: D/MediaPlayer(1297): reset() out
01-29 18:42:21.307: D/MediaPlayer(1297): release() in
01-29 18:42:21.307: D/MediaPlayer(1297): unregisterHDMINotification
01-29 18:42:21.307: E/HDMIStatusObserver(1297): status: UNPLUG
01-29 18:42:21.307: E/HDMIStatusObserver(1297): onEvent: false
01-29 18:42:21.307: V/MediaPlayer(1297): setListener
01-29 18:42:21.307: V/MediaPlayer(1297): disconnect
01-29 18:42:21.307: V/MediaPlayer(1297): destructor
01-29 18:42:21.307: V/MediaPlayer(1297): disconnect
01-29 18:42:21.307: D/MediaPlayer(1297): release() out
快速查看developer.android.com上支持的媒体格式页面页面显示,在Android的所有版本上都支持H.264(.mp4)播放(假设我正在阅读图表正确地),因此视频中的播放应该有效。但是,在Android 3.0之前不支持从HTTPS URL流式传输,如果您确实尝试从HTTPS URL进行流式传输,这将导致错误。