मैं कैमरा एपीआई 2 का उपयोग कर वीडियो रिकॉर्डिंग के आसपास काम करने के लिए Google आधिकारिक sample का उपयोग कर रहा हूं। लेकिन समस्या यह है कि मैं इसे पूर्ण स्क्रीन बनाने में सक्षम नहीं हूं क्योंकि मैंने केवल स्क्रीन अभिविन्यास को पोर्ट्रेट तक सीमित कर दिया है। यहां xml संपादित किया गया है और official xml है।कैमरा 2: पूर्ण स्क्रीन में वीडियो रिकॉर्ड करने में असमर्थ?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<AutoFitTextureView
android:id="@+id/texture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<Button
android:id="@+id/video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/label_record" />
<ImageView
android:id="@+id/info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:contentDescription="Description"
android:padding="20dp"
android:src="@drawable/ic_more" />
</FrameLayout>
</RelativeLayout>
मैं यहाँ लगता है TextureView
के पहलू राशन द्वारा वीडियो स्क्रीन आकार सेट कर रहा है लेकिन मैं इसे पूर्ण स्क्रीन करने के लिए नहीं कर सके। कोई भी मदद बहुत ही सराहनीय होगी।
mVideoSize = chooseVideoSize(map.getOutputSizes(MediaRecorder.class));
mPreviewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class), width, height, mVideoSize);
int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
mTextureView.setAspectRatio(mPreviewSize.getWidth(), mPreviewSize.getHeight());
} else {
mTextureView.setAspectRatio(mPreviewSize.getHeight(), mPreviewSize.getWidth());
}
हाँ .. यह working..thanks है :) – Stella