I'm using MediaRecorder to record the surface, So I'm defining the video size to the MediaRecorder before preparing
Size size = getWindowManager().getDefaultDisplay().getSize(size);
... preparing the media recorder
mediaRecorder.setVideoSize(size.x, size.y);
So it is working fine without notch, when comes to the devices with notch the video is recorded as black.
Please help me
Thanks in Advance
Detect and subtract the notch height
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels;
int width = displayMetrics.widthPixels;
Log.d("height",""+height);
//Detect notch
int statusBarHeight = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
}
if (statusBarHeight > Math.round( 24 * (displayMetrics.densityDpi / 160f))) {
height -= statusBarHeight;
}
Log.d("height",""+height);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With