I am trying to play a video in android using Video View, But the video is not completely stretching to fit the screen instead the video view is stretching and its showing black empty screen on either side of the Screen
I want the video to be strecthed without considering any aspect ratio.
any help on this
Thanks & Nagendra
XMl:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<VideoView android:id="@+id/myvideoview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
Code:
setContentView(R.layout.main);
getWindow().setFormat(PixelFormat.TRANSLUCENT);
videoPlayer = (VideoView) findViewById(R.id.myvideoview);
String uri = "android.resource://" + getPackageName() + "/" + R.raw.video;
videoPlayer.setVideoURI(Uri.parse(uri));
videoPlayer.setMediaController(new MediaController(this));
videoPlayer.requestFocus();
videoPlayer.setVisibility(0);
videoPlayer.start();
This is the code i am using to play a video
Thanks for your reply