如何使用 Expo 播放 Youtube 视频 [英] How to play Youtube videos using Expo

查看:25
本文介绍了如何使用 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 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆