我想使用 expo sdk 播放来自 url 的视频以进行 native react 。我阅读了 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 说 video 标签作为内联工作,但我不确定为什么它不播放视频或需要其他任何东西。
感谢您的帮助
最佳答案
import { Video } from 'expo';
您将 Expo.Video
模块导入为 Video
,但您正试图通过 Expo.Video
使用该组件。
<Video
source = {{uri :'url for vide'}}
ref={this._handleVideoRef}
/>
像这样使用它。不是 Expo.Video
关于android - React-Native 使用 expo sdk 播放视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44943637/