0

(Instant apps can play video normally use webview, but videoview fail.

Use Android Videoview play video, The APK can play normally, but the Instant apps can not play. show error: Can't play this video.

java code:

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: Couldn't open https://v1-tt.ixigua.com/40f0bfa756a159d27864bb70aeabdb8b/59f457f6/video/m/22033a84279cb1145a8bafee6279724505b1151dcf0000063157252c98c/: java.io.FileNotFoundException: No content provider: 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: Unable to create media player 10-28 06:31:01.958 21522-21522/? W/VideoView: Unable to open content: https://v1-tt.ixigua.com/40f0bfa756a159d27864bb70aeabdb8b/59f457f6/video/m/22033a84279cb1145a8bafee6279724505b1151dcf0000063157252c98c/ java.io.IOException: setDataSource failed.: status=0x80000000 at android.media.MediaPlayer.nativeSetDataSource(Native Method) at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1153) at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1141) at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1059) at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1080) at android.widget.VideoView.openVideo(VideoView.java:399) at android.widget.VideoView.-wrap0(Unknown Source:0) at android.widget.VideoView$7.surfaceCreated(VideoView.java:678) at android.view.SurfaceView.updateSurface(SurfaceView.java:664) at android.view.SurfaceView$2.onPreDraw(SurfaceView.java:143) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:977) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2337) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6733) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) at android.view.Choreographer.doCallbacks(Choreographer.java:723) at android.view.Choreographer.doFrame(Choreographer.java:658) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 10-28 06:31:01.958 21522-21522/? D/VideoView: Error: 1,0

Ajeett
  • 814
  • 2
  • 7
  • 18
m41m41
  • 47
  • 1
  • 3
  • Instead of using Uri.parse to set the URL, try using the videoView.setVideoPath as have been used in this [SO post](https://stackoverflow.com/a/40435356). – ReyAnthonyRenacia Oct 28 '17 at 23:00
  • No effect, the same error – m41m41 Oct 30 '17 at 01:16
  • @m41m41 please have a look on this link might it help you https://stackoverflow.com/questions/40433248/play-video-from-url-in-videoview-android?noredirect=1&lq=1 – Prags Oct 31 '17 at 05:07
  • setVideoPath, the same error – m41m41 Oct 31 '17 at 10:19
  • @m41m41, Incase the problem is still not solved, I would suggest you to file a bug and see if Google can assist you. Also, please share link to your bug back in here so it would be helpful for all. https://issuetracker.google.com/issues/new?component=316045&template=1018787 TIP: Google might need sample project/Instant Application (with this issue) to provide a quick solution. – Prags Nov 17 '17 at 04:51

1 Answers1

1

The error does not seem to be related to Android Instant Apps, since playing a video in this manner works.

I'm getting a 403 error when trying to access the video you provided.

Make sure that accessing the video's file access is correct for the app's user.

Ben Weiss
  • 17,182
  • 6
  • 67
  • 87
  • The problem has nothing to do with the link. At the same time, The APK can play normally, but the Instant apps can not play. – m41m41 Oct 31 '17 at 10:13