视频记录器组件,扩展自react-native-camera。适配iOS和Android。
https://github.com/phuochau/react-native-beautiful-video-recorder
npm i --save react-native-beautiful-video-recorder react-native link
使用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 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'