Android即时应用播放视频失败,显示"无法播放此视频。"

时间:2017-10-28 10:51:25

标签: android-videoview android-instant-apps

(即时应用可以播放视频通常使用网页视图,但视频视图失败。

使用Android Videoview播放视频,APK可以正常播放,但即时应用无法播放。显示错误:无法播放此视频。

java代码:

Uri uri = Uri.parse("https://v1-tt.ixigua.com/40f0bfa756a159d27864bb70aeabdb8b/59f457f6/video/m/22033a84279cb1145a8bafee6279724505b1151dcf0000063157252c98c/");
VideoView videoView = (VideoView) findViewById(R.id.videoView);
videoView.setVideoURI(uri);
videoView.start();

logcat show:

10-28 06:31:01.952 21522-21522 /? W / MediaPlayer:无法打开https://v1-tt.ixigua.com/40f0bfa756a159d27864bb70aeabdb8b/59f457f6/video/m/22033a84279cb1145a8bafee6279724505b1151dcf0000063157252c98c/:java.io.FileNotFoundException:没有内容提供者:https://v1-tt.ixigua.com/40f0bfa756a159d27864bb70aeabdb8b/59f457f6/video/m/22033a84279cb1145a8bafee6279724505b1151dcf0000063157252c98c/ 10-28 06:31:01.953 21522-21522 /? V / MediaHTTPService:MediaHTTPService(android.media.MediaHTTPService@79aba57):Cookies:null 10-28 06:31:01.954 21522-21522 /? E / MediaPlayerNative:无法创建媒体播放器 10-28 06:31:01.958 21522-21522 /? W / VideoView:无法打开内容:https://v1-tt.ixigua.com/40f0bfa756a159d27864bb70aeabdb8b/59f457f6/video/m/22033a84279cb1145a8bafee6279724505b1151dcf0000063157252c98c/                                               java.io.IOException:setDataSource failed:status = 0x80000000                                                   在android.media.MediaPlayer.nativeSetDataSource(本机方法)                                                   在android.media.MediaPlayer.setDataSource(MediaPlayer.java:1153)                                                   在android.media.MediaPlayer.setDataSource(MediaPlayer.java:1141)                                                   在android.media.MediaPlayer.setDataSource(MediaPlayer.java:1059)                                                   在android.media.MediaPlayer.setDataSource(MediaPlayer.java:1080)                                                   在android.widget.VideoView.openVideo(VideoView.java:399)                                                   在android.widget.VideoView.-wrap0(未知来源:0)                                                   在android.widget.VideoView $ 7.surfaceCreated(VideoView.java:678)                                                   在android.view.SurfaceView.updateSurface(SurfaceView.java:664)                                                   在android.view.SurfaceView $ 2.onPreDraw(SurfaceView.java:143)                                                   在android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:977)                                                   在android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2337)                                                   在android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386)                                                   在android.view.ViewRootImpl $ TraversalRunnable.run(ViewRootImpl.java:6733)                                                   在android.view.Choreographer $ CallbackRecord.run(Choreographer.java:911)                                                   在android.view.Choreographer.doCallbacks(Choreographer.java:723)                                                   在android.view.Choreographer.doFrame(Choreographer.java:658)                                                   在android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java:897)                                                   在android.os.Handler.handleCallback(Handler.java:789)                                                   在android.os.Handler.dispatchMessage(Handler.java:98)                                                   在android.os.Looper.loop(Looper.java:164)                                                   在android.app.ActivityThread.main(ActivityThread.java:6541)                                                   at java.lang.reflect.Method.invoke(Native Method)                                                   在com.android.internal.os.Zygote $ MethodAndArgsCaller.run(Zygote.java:240)                                                   在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 10-28 06:31:01.958 21522-21522 /? D / VideoView:错误:1,0

1 个答案:

答案 0 :(得分:1)

该错误似乎与Android Instant Apps无关,因为以这种方式播放视频有效。

尝试访问the video you provided时收到403错误。

确保访问视频的文件访问权限对于应用的用户来说是正确的。