基于react-native-camera修改后的前后摄像头切换续拍组件
npm install react-native-camera-continued-shootingreact-native link react-native-camera-continued-shooting链接Android和iOS原生模块
#### Android端额外配置
将react-native-camera-continued-shooting/android/lib目录下的lansongsdk第三方依赖库拷贝到自己项目android目录下,然后在项目settings.gradle做以下配置,然后clean build运行
``java`
include ':lansongsdk'`
#### iOS端额外配置
直接进入ios目录执行pod install然后关闭Xcode重新打开项目完成所有依赖.$3
javascript
//@ts-ignore
import Camera from 'react-native-camera-continued-shooting';
render() {
let {cameraType} = this.state;
return (
this.camera = cam;
}}
orientation={'portrait'}
type={cameraType}
style={styles.preview}
captureAudio
autoFocus={'on'}
captureMode={Camera.constants.CaptureMode.video}
captureTarget={Camera.constants.CaptureTarget.temp}
aspect={Camera.constants.Aspect.fill}>
{this.renderContent()}
);
}
//开始录制视频
this.camera.startCapture();
//暂停录制视频
this.camera.pauseCapture();
//继续录制视频
this.camera.startCapture();
//终止录制视频
this.camera.stopCapture().then((path) => {
console.log('视频录制本地路径',path);
}).catch(err => console.error(err));
//重新录制视频
this.camera.resetCamera();
this.camera.startCapture();
``
相关链接阿里云视频点播组件react-native-aliyun-playview