Używam google official sample do obejścia nagrywania wideo przy użyciu Camera API 2. ale problem polega na tym, że nie jestem w stanie zrobić tego na pełnym ekranie, ponieważ ograniczyłem orientację ekranu tylko do portretu.Tutaj edytowałem xml i official xml.Kamera 2: Nie można nagrać wideo na pełnym ekranie?
<?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>
myślę tutaj jest ustawienie rozmiaru ekranu wideo od kształtu porcji do TextureView
ale nie mogłem zrobić to do pełnego ekranu. Każda pomoc jest bardzo doceniana.
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());
}
Tak .. To working..thanks :) – Stella