Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] java – Android VideoView I get randomly a “Can’t play this video” error

Posted on November 14, 2022

Solution 1 :

Try this

   Uri uri= Uri.parse(Environment.getExternalStorageDirectory().getAbsolutePath()+"/yourvideopath");

 videoView.setVideoURI(uri);
videoView.start();

You can get the path of your video stored in external storage by using this.
Replace “/yourvideopath” with your video path such as /dcim/camera/mov_bbb.mp4

Problem :

I would like to play a video using VideoView:

videoView.setVideoURI(Uri.parse("http://192.168.1.10:7777/mov_bbb.mp4"));
videoView.start();

It works randomly. 20% of the time the video is loaded, and it starts. But 80% of the time, I get this error:

Can't play this video

This is outputted to the console:

W/MediaPlayer: Couldn't open http://192.168.1.10:7777/...
    java.io.FileNotFoundException: No content provider: http://192.168.1.10:7777/mov_bbb.mp4
        at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1673)
        at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1503)
        at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1420)
        at android.media.MediaPlayer.attemptDataSource(MediaPlayer.java:1101)
        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1073)
        at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1097)
        at android.widget.VideoView.openVideo(VideoView.java:412)
        at android.widget.VideoView.access$2200(VideoView.java:83)
        at android.widget.VideoView$7.surfaceCreated(VideoView.java:694)
        at android.view.SurfaceView.updateSurface(SurfaceView.java:758)
        at android.view.SurfaceView$2.onPreDraw(SurfaceView.java:155)
        at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1088)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2745)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1721)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7598)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966)
        at android.view.Choreographer.doCallbacks(Choreographer.java:790)
        at android.view.Choreographer.doFrame(Choreographer.java:725)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:951)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
V/MediaHTTPService: MediaHTTPService([email protected]): Cookies: null
D/EGL_emulation: eglMakeCurrent: 0xe331a180: ver 3 0 (tinfo 0xe330f830)
V/MediaHTTPService: makeHTTPConnection: CookieHandler ([email protected]) exists.
V/MediaHTTPService: makeHTTPConnection(android.media[email protected]): cookieHandler: [email protected] Cookies: null
D/EGL_emulation: eglMakeCurrent: 0xe331a180: ver 3 0 (tinfo 0xe330f830)
D/EGL_emulation: eglMakeCurrent: 0xe331a180: ver 3 0 (tinfo 0xe330f830)
W/MediaHTTPConnection: readAt 516238 / 32768 => java.net.ProtocolException
E/MediaPlayerNative: error (1, -2147483648)
E/MediaPlayer: Error (1,-2147483648)

I have no idea how to debug this. Is it possible to catch these errors, disable the alert, and just silently retry?

If I open the url in a browser, the video loads and plays perfectly.

Comments

Comment posted by Iter Ator

My video is not in the external storage

Comment posted by Mohit kumar jha

oh, so where is it? can you tell from where you want to fetch the video to play in VideoView.?

Comment posted by Mohit kumar jha

ok. So you are using the URL to set the VideoView. so It’s better to use setVideoPath method instead of setVideoUri.

READ  [ANSWERED] java - App crashes when I return to map activity containing ad banner?
Powered by Inline Related Posts

Comment posted by Mohit kumar jha

videoView.setVideoPath(“http:// 192.168.1.10:7777/mov_bbb.mp4”); videoView.start();

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress