如何使用Expo播放Youtube视频 [英] How to play Youtube videos using Expo
问题描述
我正在尝试在我的 react-native-youtube组件中使用世博会项目.但是,我无法使它正常工作.到目前为止,我所拥有的只是一个带有红色边框的黑屏.我尝试按照在线上的视频说明进行操作,但是expo没有iOS或Android文件夹,这意味着我无法在XCode中打开它并弄弄它.如何使用Expo播放youtube视频?正如您可能从我的问题中注意到的那样,我是第一次使用expo进行本机反应.
I am trying to use the react-native-youtube component in my expo project. However, I couldn't get it to work. All I have so far is a black screen with red borders. I tried following the video instructions on online however, expo doesn't have an iOS or Android folder, which means I can't open it in XCode and fiddle with it. How can I play youtube videos using expo? As you might have noticed from my question I'm new to react-native using expo.
推荐答案
目前,Expo不支持YouTube.您可以分离项目并安装 react-native-youtube 库或加载这样从WebView获取您的视频:
At the moment, YouTube is not supported by Expo. You can either deatach the project and install the react-native-youtube library or load your videos from a WebView like this:
<WebView
style={{flex:1}}
javaScriptEnabled={true}
source={{uri: 'https://www.youtube.com/embed/ZZ5LpwO-An4?rel=0&autoplay=0&showinfo=0&controls=0'}}
/>
这篇关于如何使用Expo播放Youtube视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!