没有合适的资源?快使用搜索试试~ 我知道了~
Android使用MediaRecorder实现录像功能
5星 · 超过95%的资源 18 下载量 40 浏览量
2020-08-30
05:50:29
上传
评论
收藏 66KB PDF 举报
温馨提示
试读
6页
主要为大家详细介绍了Android使用MediaRecorder实现录像功能,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
资源推荐
资源详情
资源评论
Android使用使用MediaRecorder实现录像功能实现录像功能
主要为大家详细介绍了Android使用MediaRecorder实现录像功能,具有一定的参考价值,感兴趣的小伙伴们可
以参考一下
用MediaRecorder实现简单的录像功能
思路:思路:定义一个SurfaceView用来显示预览,在SurfaceHolder的回调中用Camera对象启动预览。然后调用MediaRecorder来
录像。仅仅是实现了简单的录像開始和停止功能。顶部能显示显示录像的时间,还有待完好。
代码例如以下:
在AndroidManifest.xml加入以下的权限:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- 硬件支持 -->
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
activity_main.xml
<RelativeLayout 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" >
<SurfaceView
android:id="@+id/camera_preview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<TextView
android:id="@+id/timestamp_minute_prefix"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#7F00FF"
android:textSize="30sp"
android:text="0"/>
<TextView
android:id="@+id/timestamp_minute_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#7F00FF"
android:textSize="30sp"
android:text="0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#7F00FF"
android:textSize="30sp"
android:text=":"/>
<TextView
android:id="@+id/timestamp_second_prefix"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#7F00FF"
android:textSize="30sp"
android:text="0"/>
<TextView
android:id="@+id/timestamp_second_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#7F00FF"
android:textSize="30sp"
android:text="0"/>
资源评论
- FelaniaLiu2023-07-27这篇文章介绍了如何使用MediaRecorder在Android上录制视频,非常实用。
- 会飞的黄油2023-07-27这篇文章对于如何在Android上录制视频进行了详细解释,其中的步骤十分清晰,非常适合初学者阅读。
- 黄涵奕2023-07-27作者对于MediaRecorder的介绍详细而简洁,让我能够快速了解其基本原理和用法。
- 十二.122023-07-27文章中提供了清晰的代码示例,让我能够快速理解如何在Android上实现录像功能。
- 罗小熙2023-07-27通过这篇文章,我学会了使用MediaRecorder录制视频的基本步骤,很容易上手。
weixin_38621630
- 粉丝: 3
- 资源: 914
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功