我有一个mp4文件,我使用手刹使用H.264 Baseline编码进行转换。这在浏览器中流畅。
我创建了一个可以在VideoView中传输此视频的应用。我已经在4.0.1和4.3中测试过,它运行正常。视频播放完美。
使用2.3.3安卓模拟器,我可以听到声音,但没有视频。当我在实际的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
答案 0 :(得分:0)
快速查看developer.android.com上的supported media formats page,可以看到所有版本的Android都支持H.264(.mp4)播放(假设我正在正确阅读图表),因此请回放VideoView应该可以工作。但是,在Android 3.0之前不支持从HTTPS URL流式传输,如果您确实尝试从HTTPS URL流式传输,则会导致错误。