Playing youtube videos on iOS(在 iOS 上播放 youtube 视频)
问题描述
我想知道 McTube(https://itunes.apple.com/us/app/mctube-for-youtube/id559618284?mt=8) 播放 youtube 视频.它看起来像一个自定义的 MPMoviePlayerController
,但允许这样做吗?
I was wondering how are apps like McTube (https://itunes.apple.com/us/app/mctube-for-youtube/id559618284?mt=8) playing youtube videos. It looks like a custom MPMoviePlayerController
but is that allowed?
顺便说一句,我需要使用 UIWebView
无法实现的自动播放,这就是我想知道的原因.
BTW I need autoplay which I couldn't achieve with UIWebView
, that's why i was wondering.
推荐答案
有些 YouTube 视频可以在 MPMoviePlayerController
中播放 - 有些不能.当您通过 YouTube 数据 API(此处链接)查询视频时,您将获取特定视频可用的所有内容类型,包括 Flash 播放器、3GPP、MP4(如果可用)等.您可以使用这些 URL 加载 MPMoviePlayerController
.
Some YouTube videos can be played back in a MPMoviePlayerController
- some cannot. When you query a video through the YouTube Data API (link here) you'll get back all the content types available for a particular videos, including the Flash player, 3GPP, MP4 (if available), etc. You can use these URLs to load up a MPMoviePlayerController
.
这很好,但正如我所说 - 并非所有视频都可以通过这种方式嵌入.某些视频(主要是需要展示广告的视频)无法放入原生控制器.
This is perfectly fine, but as I've said - not all videos are available to embed this way. Some videos (mainly ones that require adverts to be displayed) can't be put into native controllers.
这篇关于在 iOS 上播放 youtube 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 iOS 上播放 youtube 视频


基础教程推荐
- NSString intValue 不能用于检索电话号码 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01