我想使用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',
},
});
Doc说视频标签就像内联一样,但我不确定为什么它不播放视频或需要更多内容。
感谢您的帮助
答案 0 :(得分:1)
import { Video } from 'expo';
您已将Expo.Video
模块导入为Video
,但您尝试通过Expo.Video
使用该组件。
<Video
source = {{uri :'url for vide'}}
ref={this._handleVideoRef}
/>
像这样使用它。不是Expo.Video