我想在我的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视频
发布评论