<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_video_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.kavinduwijesuriya.camera_test.VideoPreviewActivity">
<VideoView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:id="@+id/videoPreview">
</VideoView>
</RelativeLayout>
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_preview2);
String fileUrl = getIntent().getStringExtra("filePath");
VideoView videoPreview = (VideoView) findViewById(R.id.videoPreview);
videoPreview.setVideoPath(fileUrl);
videoPreview.start();
}
I am trying to play a video recorded by the camera to be played on a video view that takes full screen width and height. Currently the video is being stretched in different ways in different devices.
Can anyone suggest a method to stop the video from stretching?