我无法通过相机胶卷库显示视频,它只显示图像

时间:2018-06-07 15:58:41

标签: reactjs react-native expo camera-roll

I want to show the videos, no need to open them just want to display them in this format

  

这是我开发的代码,用于访问来自图库的15张图片,现在我   我试图从图库中访问15个视频,我看到了文档   并将assestType更改为视频,并且没有发生任何更改,我正在使用    世博会和操作系统是安卓。

constructor(props) {
    super(props)
    let controls = props.controls
    this.state = {
      images: [],
      fetchParams: { first: 15 },
      assestType: 'Videos'
    }
    this._storeImages = this._storeImages.bind(this)
    this._logImageError = this._logImageError.bind(this)   }

  componentDidMount() {
    CameraRoll.getPhotos(this.state.fetchParams, this._storeImages, this._logImageError);   }

  _storeImages(data) {
    const assets = data.edges;
    const images = assets.map( asset => asset.node.image );
    this.setState({
        images: images,
    });   }

  _logImageError(err) {
      console.log(err);   }


  render() {
    return (
      <View style={{flex: 1, backgroundColor: 'white'}}>
        <ScrollView style={styles.container}>
            <View style={styles.imageGrid}>
            { this.state.images.map(image => {
              console.log(image.uri);
              return (
                 <Image style={styles.image} source={{ uri: image.uri }} />
             );
            })}
            </View>
        </ScrollView>
      </View>
    );   } }

0 个答案:

没有答案