使用expo sdk的本机播放视频

问题描述 投票:1回答:2

我想使用expo sdk从URL播放视频以进行本机响应。我阅读了sdk,但我无法理解如何使其正常工作。Here is link for expo sdk video docs.

这是我的代码

 import React from 'react';
import { StyleSheet, Text, View,Button } from 'react-native';
import { Video } from 'expo';

export default class App extends React.Component {
    _handleVideoRef = component => {

    }

    onPlayPressed(){

    }

  render() {

    return (
      <View style={styles.container}>
            <Expo.Video
            source = {{uri :'url for video'}}
            ref={this._handleVideoRef}

            />
            <Text>Open up App.js to start working on your app! </Text>
            <Button onPress={this.onPlayPressed.bind(this)} title = "Play"/>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

医生说视频标签可作为嵌入式标签使用,但我不确定为什么不播放视频或需要更多内容。

感谢您的帮助

android ios react-native expo
2个回答
2
投票
import { Video } from 'expo';

您将Expo.Video模块导入为Video,但是您正试图通过Expo.Video使用该组件。

<Video
  source = {{uri :'url for vide'}}
  ref={this._handleVideoRef}
/>

像这样使用。不是Expo.Video

© www.soinside.com 2019 - 2024. All rights reserved.