react-native-beautiful-video-recorder 视频记录器组件

视频记录器组件,扩展自react-native-camera。适配iOS和Android。

https://github.com/phuochau/react-native-beautiful-video-recorder

特性:

  • 在iOS和Android上记录视频
  • 在iOS上将MOV转换为MP4。因此Android&iOS都会返回MP4格式。

安装

npm i --save react-native-beautiful-video-recorder
react-native link

配置

iOS

使用iOS 10或者更高的版本,你需要将"Privacy - Camera Usage Description"键添加到项目的info.plist。这将会在'your_project/ios/your_project/Info.plist'中找到。添加下列代码:

NSCameraUsageDescription
Your message to user when the camera is accessed for the first time


NSMicrophoneUsageDescription
Your message to user when the microsphone is accessed for the first time

Android

在Android Manifest中添加权限




使用方法

import VideoRecorder from 'react-native-beautiful-video-recorder';
....

start = () => {
	this.videoRecorder.open((data) => {
		console.log('captured data', data);
	});
}

render() {
	return (
		
			......
		  
		  	Start
		  
		   { this.videoRecorder = ref; }} compressQuality={'medium'} /> // quality will be 'low', 'medium' or 'high'
		
	);
}

你可能感兴趣的:(】)