私はhttps://github.com/lwansbrough/react-native-cameraの反応ネイティブビデオカメラを使用していたプロジェクトで作業していました。コンポーネントはビデオを取り込み、データはXcodeのコンソールに表示されます。残念なことに、私はこのファイルといくつかの他のものをコンピュータ上で失い、最初からアプリを起動しています。私はビデオ録画機能を備えたカメラを再現しようとしていますが、動作させることはできません。誰かが私が間違って何をしているのか分かりません。キャプチャモードをカメラに変更するとデータが出力されますが、ビデオは何も起こりません。ここに私のコンポーネントである:あなたがcamera.capture
に空のオブジェクトを渡しているあなたの_recordVideo
方法で反応ネイティブカメラでビデオを録画する方法
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()
}
}
http://stackoverflow.com/questions/37960958/how-do-i-access-the-react-native-cameras-video-capabilities – Tarun