How to play Youtube videos using Expo(如何使用 Expo 播放 Youtube 视频)
问题描述
我正在尝试在我的世博项目.但是,我无法让它工作.到目前为止,我只有一个带有红色边框的黑屏.我尝试按照 online 上的视频说明进行操作,但是,世博会没有 iOS 或 Android文件夹,这意味着我无法在 XCode 中打开它并摆弄它.如何使用 expo 播放 youtube 视频?正如您可能已经从我的问题中注意到的那样,我是使用 expo 的 react-native 新手.
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 eject 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 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 Expo 播放 Youtube 视频
基础教程推荐
- AdMob 广告未在模拟器中显示 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
