I am working on an app where I have to record a video which is supposed to be in Portrait View
specifically and play it in Portrait View
as well. I'm using mediaRecorder
to record the video.
Have used this site for reference: https://examples.javacodegeeks.com/android/core/android-video-capture-example/
and made slight changes to suit my requirements:
Here is the code:
For the camera I use these settings:
mCamera = Camera.open(findFrontFacingCamera());
mCamera.setDisplayOrientation(90);
Camera.Parameters params= mCamera.getParameters();
params.set("rotation", 90);
params.set("orientation", "portrait");
mCamera.setParameters(params);
mPreview.refreshCamera(mCamera);
The problem I'm facing right now is that video gets recorded (what seems to be) in Portrait View
but when I play it using any player for eg. MX Player I get a video that is recorded/played in Landscape View
.
Here are the screens for reference:
I have used the setDisplayOrientation(90)
parameter but its not working.
How do I achieve that I'm trying to achieve?