如何在react-native

时间:2017-12-04 08:13:54

标签: android react-native

**当我停止在图库中录制捕获视频商店时如何获取该视频以便我在服务器上传该视频**

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) => alert(data))
        .catch((err) => console.log(err))
      }

_endVideo() {
     this.refs.camera.stopCapture()
    .then((response) => {                                      
               alert(response);   

         // so here what i do for fetching video file path for upload           
    } 

我只是在服务器上传录制的视频......

1 个答案:

答案 0 :(得分:1)

public interface UserRepository extends JpaRepository<User, Long> { @Query("select u from User u where u.username = ?1") User findByEmailAddress(String emailAddress); } 读取路径,然后您可以使用react-native-fs打开文件。

来自document

  

path:返回磁盘上捕获的图像或视频文件的路径

data.path