我想使用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',
},
});
医生说视频标签可作为嵌入式标签使用,但我不确定为什么不播放视频或需要更多内容。
感谢您的帮助
import { Video } from 'expo';
您将Expo.Video
模块导入为Video
,但是您正试图通过Expo.Video
使用该组件。
<Video
source = {{uri :'url for vide'}}
ref={this._handleVideoRef}
/>
像这样使用。不是Expo.Video