So, I worked on a project that used a reactive graphics card from https://github.com/lwansbrough/react-native-camera and it worked. The component will take the video and the data will be printed in the Xcode console. Unfortunately, I lost this file and a couple of others on my computer, and I'm starting the application from scratch. I am trying to recreate a camera with the ability to record video, but I can not get it to work. Does anyone know what I am doing wrong because I cannot understand this. Data will be printed when the captureMode mode is changed to the camera, but nothing will happen for the video. Here is my component:
let startVideo = false; class VideoCamera extends Component { constructor() { super() this.state = { captureMode: Camera.constants.CaptureMode.video, } } render() { return ( <Camera captureMode={this.state.captureMode} ref="camera" style={styles.container} > <TouchableHighlight onPressIn={this._startRecord.bind(this)} onPressOut={this._endVideo.bind(this)} > <Icon name={'video-camera'} size={40} style={styles.recordButton} /> </TouchableHighlight> </Camera> ) } _startRecord() { startVideo = setTimeout(this._recordVideo.bind(this), 50) } _recordVideo() { this.refs.camera.capture({}) .then((data) => console.log(data)) .catch((err) => console.log(err)) } _endVideo() { this.refs.camera.stopCapture() } }
source share