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.
link 2
Is anybody ever faced this kind of problem ? If yes then how can it solve it ?
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.
SOLUTION 1:
videoView.setZOrderOnTop(true);
this will set the videoview to the top layer; In other words: block everything under it.
SOLUTION 2:
videoView.setBackgroundColor(Color.TRANSPARENT);
SOLUTION 3:
sometimes this is related about your apptheme; In my case, I changed the apptheme from @style/AppTheme
to @android:style/Theme.NoTitleBar.Fullscreen
fix my problem.
try this :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<VideoView
android:id="@+id/view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
it may be help you...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With