Video is not showing on VideoView but I can hear its sound

Dhruvil Patel picture Dhruvil Patel · Oct 29, 2013 · Viewed 21.5k times · Source
  • On my button click I wrote the following code for playing video from my SDCARD (mp4).

    video_view = (VideoView)findViewById(R.id.video_view);
    video_view.setVideoPath("/sdcard/myvideo.mp4");
    video_view.setMediaController(new MediaController(this));
    video_view.start(); 
    
  • I can play recorded video from SDCARD in player.

  • But when I run it on my application in videoview I can hear only sound.
  • Problem : I am not able to see the video.

---- I tried following SO link but still no luck ----

  • link 1
  • link 2

  • Is anybody ever faced this kind of problem ? If yes then how can it solve it ?

Answer

SeaStar picture SeaStar · Nov 21, 2013

I've tried every method above, but none of them could work.

Finally, I tried to call this function, then the video appeared.

video_view.setZOrderOnTop(true);

Hope this also works for you.