Your application has a job to do, and integrating videos is only a small part of it. You want to take videos with minimal fuss, and not reinvent the camcorder. Happily, most Android-powered devices already have a camera application that records video. In
this lesson, you make it do this for you.http://blog.csdn.net/sergeycao
Request Camera Permission
To advertise that your application depends on having a camera, put a <uses-feature>
tag in the manifest file:
<manifest ... >
<uses-feature android:name="android.hardware.camera" />
...
</manifest ... >
If your application uses, but does not require a camera in order to function, add
android:required="false"
to the tag. In doing so, Google Play will allow devices without a camera to download your application. It's then your responsibility to check for the availability of the camera at runtime by calling
hasSystemFeature(PackageManager.FEATURE_CAMERA)
. If a camera is not available, you should then disable your camera features.
Record a Video with a Camera App
The Android way of delegating actions to other applications is to invoke an
Intent
that describes what you want done. This involves three pieces: the
Intent
itself, a call to start the external Activity
, and some code to handle the video when focus returns to your activity.
Here's a function that invokes an intent to capture video.
private void dispatchTakeVideoIntent() {
Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(takeVideoIntent, ACTION_TAKE_VIDEO);
}
It's a good idea to make sure an app exists to handle your intent before invoking it. Here's a function that checks for apps that can handle your intent:
public static boolean isIntentAvailable(Context context, String action) {
final PackageManager packageManager = context.getPackageManager();
final Intent intent = new Intent(action);
List<ResolveInfo> list =
packageManager.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}
View the Video
The Android Camera application returns the video in the Intent
delivered to
onActivityResult()
as a Uri
pointing to the video location in storage. The following code retrieves this video and displays it in a
VideoView
.
private void handleCameraVideo(Intent intent) {
mVideoUri = intent.getData();
mVideoView.setVideoURI(mVideoUri);
}
分享到:
相关推荐
NatCorder - Video Recording API 1.7.1 完整项目 [插件] 官方的录屏插件 NatCorder 资源名称: NatCorder 资源版本: 1.7.1 资源类型: .unitypackage 资源大小: 409.3kb 更新时间: 2020-04-29 支持正版: ↓...
录制的兼容性选项,可以使用以前的录制引擎来录制脚本 Recording schemes 录制内容的过滤 Headers 对于Headers录制内容的过滤 Content Types 对于录制的正文内容进行过滤 Non-Resource 对于非资源的内容进行...
视频录制API unity 支持Android iOS windows平台下视频的录制 NatCorder is a lightweight, easy-to-use, full-feature video recording API for iOS, Android, macOS, and Windows. With NatCorder, you can record...
ios应用源码之录制音频 demo recording .
IOS应用源码——录制音频 demo Recording.zip
Streaming Screen Recording是一款非常不错的屏幕视频录制工具,可以帮助你将屏幕上指定范围的所有动作和声音录制成WMV格式的视频文件并保存下来,非常简单易用! 程序可设定自定义CPU核心的数量,可设定优先级别,...
NatCorder是适用于iOS,Android,macOS和Windows的轻巧,易于使用的全功能视频录制API。使用NatCorder,您可以记录屏幕,特定的游戏摄像头,纹理,原始像素数据等。您还可以录制来自音频源,听众和自定义源的游戏...
WebEx Recording Editor V2.8 编辑录屏文件
NatCorder - Video Recording API 1.7.1
webex webex player editor recording 三套件 一应俱全
高效:试用时录制培训内容(含声音)1.5小时才6MB 商用级:此产品不是面向个人的软件,而是完整的商业交流方案中的一个小工具,因此,效率和稳定性可以保证。 文件格式:独有的wrf格式,需用它的player播放...
录屏软件webEx,包括WebEx Player;WebEx Recording Editor;WebEx Recorder。
The Call Recording feature allows system administrators or authorized personnel to archive conversations between the agent and the customer. Cisco Unified Communications Manager supports the Silent ...
WebEx Recording Editor 包含WebEx Recorder及Editor Windows版。 Version 29.3.0.17099 2014年3月7日下载。
最好的录屏软件的最新版。占资源极小且压缩比极高。用editor可以转化为wmv格式。
小型录屏软件只有408k,解压就能用,只录图像不录声音,特点就是轻巧,不占内存使用方便
WebEx Recording Editor 31.14.1.9 完美绿色版,验证WIN10可用。
Modern Recording Techniques(9th) 英文无水印原版pdf 第9版 pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看...
A Traffic Accident Recording and Reporting Model at Intersections
alsa-sound recording