Android中用MediaRecorder进行录影的实例代码

2019-12-10 20:11:20王旭
易采站长站为您分析Android中用MediaRecorder进行录影的实例代码,有需要的朋友可以参考一下    

MediaRecorder进行录影和录音没什么差别 ,就多了一个设置图像的格式

参考:http://www.easck.com/article/46182.htm

实例:

复制代码
    <!-- 授予该程序录制声音的权限 -->
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <!-- 授予该程序使用摄像头的权限 -->
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    <!-- 授予使用外部存储的权限 -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

 

 

复制代码
<RelativeLayout xmlns:android="http://www.easck.com/apk/res/android"
    xmlns:tools="http://www.easck.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

 

    <SurfaceView
        android:id="@+id/dView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"  
        android:orientation="horizontal" >

        <Button