1、开源项目效果界面
2、LandscapeVideoCamera提供了完整的可复用的自定义camera,有如下特点:(1)强制用户横屏录制(当为竖屏的时候是不能录制的)(2)允许指定录制视频的文件名,当然也支持自动生成文件名。(3)允许改变如下设置: 分辨率 码率 视频文件最大占用空间 视频录制时间
3、在manifest中添加VideoCaptureActivity
4、在manifest中添加如下权限<uses-permission andro坡纠课柩id:name="android.permission.RECORD_AUDIO" /><uses-permission android:name="android.permission.CAMERA" /><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
5、创建CaptureConfiguration对象,根据需要选择合适的构造方法Capture configur锾攒揉敫ation = CaptureConfiguration(CaptureResolution resolution, CaptureQuality quality);Capture configuration = CaptureConfiguration(CaptureResolution resolution, CaptureQuality quality, int maxDurationSecs, int maxFilesizeMb);Capture configuration = CaptureConfiguration(int videoWidth, int videoHeight, int bitrate);Capture configuration = CaptureConfiguration(int videoWidth, int videoHeight, int bitrate, int maxDurationSecs, int maxFilesizeMb
6、用startActivityForResult调用VideoCaptureActivity,CaptureConfiguration 作为parcelable类型参数EXTRA_CAPTURE_CONFIGURATION传递,文件名作为String类型参数EXTRA_OUTPUT_FILENAME传递。