【发布时间】:2018-05-17 19:10:21
【问题描述】:
当我获得视频路径时,我如何使用react-native 将该视频存储在firebase 存储中?
file://storage/emulated/0/DCIM/1234.MP4....我知道那条路
这是我创建录像机并获取录制的视频文件路径的代码。
import Camera from 'react-native-camera';
<Camera
captureMode={this.state.captureMode}
captureAudio={this.state.captureAudio}
captureTarget={this.state.captureTarget}
ref="camera"
style={styles.preview}>
{ toggle? <TouchableOpacity onPress={() =>this._startRecord()}>
<Image style={styles.clickimage}
source={require('../images/icon_record_stop.png')} />
</TouchableOpacity>
: <TouchableOpacity onPress={() =>this._endVideo()}>
<Image style={styles.clickimage}
source={require('../images/clickimage.png')} />
</TouchableOpacity>
}
</Camera>
_startRecord() {
this.refs.camera.capture({mode: Camera.constants.CaptureMode.video})
.then((data) => {
this.setState({
storagepathdata:data.path
});
// var path = data.path;
})
.catch((err) => console.log(err))
}
_endVideo() {
this.refs.camera.stopCapture()
.then((response) => {
alert(this.state.storagepathdata);
// here storagepathdata is a file path so what i do to store that video on firebase?
}
【问题讨论】:
-
请说得更具体一些。您应该提供代码、布局等相关的 sn-ps。看看how-to-ask。另外,请详细查看How to create a Minimal, Complete, and Verifiable example。
标签: android firebase react-native firebase-storage