0
<?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?

  • This may help. Refer @caiocpricci2 answer here http://stackoverflow.com/questions/12211837/full-screen-videoview-without-stretching-the-video – Akshay Bhat 'AB' Oct 20 '16 at 11:40
  • @AkshayBhat I have tried that solution. But it still kept stretching. [example link](https://photos.google.com/share/AF1QipPsExXH0SSVY60qWsiNEIw0Wvh4ZBnNGb0-tysq9btQUrFgJj-9N1zAgPOyT8JZHQ?key=ajYtRUhjcHk1TlM2cVFEVTJrbnJIRFRkM20zTHJn) – Kavindu Wijesuriya Oct 20 '16 at 11:53

0 Answers0