因此,我正在研究一個項目,該項目使用https://github.com/lwansbrough/react-native-camera的react-native視頻攝像頭並使其工作。該組件將拍攝視頻,數據將在Xcode控制檯中打印。不幸的是我在我的電腦上丟失了這個文件和其他一些文件,我從頭開始重新啓動應用程序。我一直在嘗試重新創建具有視頻錄製功能的相機,但無法使其工作。有人知道我做錯了什麼,因爲我似乎無法弄清楚。當我將captureMode更改爲相機時,數據將會打印出來,但視頻不會發生任何變化。這裏是我的組件:如何使用react-native-camera拍攝視頻
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