Search code examples
androidfullscreenvideo-capture

full screen on video capture android


enter image description hereI need full screen on Video Capture but I am unable to do.I am posting my code.please help me

  public void startRecordingVideo() {
    if (getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT)) {
        Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
        File mediaFile = new File(
                Environment.getExternalStorageDirectory().getAbsolutePath() + "/myvideo.mp4");
        videoUri = Uri.fromFile(mediaFile);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri);
        startActivityForResult(intent, VIDEO_CAPTURE);
    } else {
        Toast.makeText(this.getActivity(), "No camera on device", Toast.LENGTH_LONG).show();
    }
}

Solution

  • From the Android MediaStore documentation ,

    EXTRA_FULL_SCREEN

    The name of an Intent-extra used to control the UI of a ViewImage. This is a boolean property that overrides the activity's default fullscreen state.

    And there is one more case where it give the padding is because of the camera resolution, in my case if i use 320*240 it is giving the same padding but if i use the 1280*720 or more than that it is not showing any padding and fitting the full screen.

    For this you can use MediaStore.EXTRA_VIDEO_QUALITY parameter to set the video quality also.

    So in your case try to use like this ,

     public void startRecordingVideo() {
        if (getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT)) {
            Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
            File mediaFile = new File(
                    Environment.getExternalStorageDirectory().getAbsolutePath() + "/myvideo.mp4");
            videoUri = Uri.fromFile(mediaFile);
            intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
            intent.putExtra(MediaStore.EXTRA_FULL_SCREEN , true);
            intent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri);
            startActivityForResult(intent, VIDEO_CAPTURE);
        } else {
            Toast.makeText(this.getActivity(), "No camera on device", Toast.LENGTH_LONG).show();
        }
    }