自Android SDK 1.6 开始,录制视频需要将照相机所看到的内容预览到Surface对象上。采用真机测试。
布局文件:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<Button
android:id="@+id/initBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Initialize Recorder"
android:onClick="doClick"
android:enabled="false"
/>
<Button
android:id="@+id/beginBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Begin Recording"
android:onClick="doClick"
android:enabled="false"
/>
<Button
android:id="@+id/stopBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Stop Recording"
android:onClick="doClick"
/>
<Button
android:id="@+id/playRecordingBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Play Recording"
android:onClick="doClick"
/>
<Button
android:id="@+id/stopPlayingRecordingBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Stop Playing"
android:onClick="doClick"