在iOS应用中播放YouTube视频

编程入门 行业动态 更新时间:2024-10-23 22:28:33
本文介绍了在iOS应用中播放YouTube视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在我的iOS应用中播放youtube视频.我进行了搜索,但发现的唯一解决方案是将youtube视频嵌入到iOS应用中,该视频在Webview中播放,因此,我们可以滚动并播放建议的其他视频. 我不想在Webview中播放视频,我想像在播放器中播放视频一样播放视频,并且用户无法滚动它. 在Swift中有什么解决方案吗?我也不想使用违反Youtube条款和条件的库

I want to play youtube videos in my iOS App. I searched for that but the only solution I found is to embed youtube videos in the iOS app, in which video plays in webview, so in that, we can scroll and also play other videos which are in suggestion. I don't want to play video in webview, I want to play video just like it plays in player and user cannot scroll it. Is there any solution for that in Swift and also I don't want to use libraries which are against terms and condition of Youtube

推荐答案

如果您不想使用YouTube提供的API,而是继续使用UIWebView.这是另一个解决方案.

Here's another solution if you don't want to use the API provided by YouTube and instead continue using a UIWebView.

YouTube具有使用格式为www.youtube/embed/<videoId>的URL在Webview中全屏加载任何视频而无需任何滚动功能的功能.

YouTube has functionality to load any video in fullscreen in a webview without any of the scrolling features using a URL in the format www.youtube/embed/<videoId>.

例如,要使用此方法加载江南风格,只需将UIWebView定向到URL www.youtube/embed/9bZkp7q19f0 .

For example, to load Gangnam Style using this method, simply direct the UIWebView to the URL www.youtube/embed/9bZkp7q19f0.

更多推荐

在iOS应用中播放YouTube视频

本文发布于:2023-11-23 13:54:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1621669.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视频   iOS   YouTube

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!