Playing video from youtube link without UIWebView

僤鯓⒐⒋嵵緔 提交于 2019-12-08 02:01:48

问题


I want to play a video in my app from youtube link e.g: http://www.youtube.com/watch?v=Uner-3tTY1I.

But i don't want to redirect the user to any web view in the app. Just want to play that video in the video player in the current view of my application.

Is it possible to play the video without redirecting to UIWebView? If possible, how can i do this? Thanks for the help in advance.


回答1:


The only allowed way seems to be using UIWebview. Doing it other way will violate youtube copyrights.

However there are few open source libraries out there. You can use it at your own risk.




回答2:


Yes please look at the youtube api to help you get started. Watch this nice tutorial on how to implement and use all the features of the youtube API.




回答3:


Just use XCDYouTubeVideoPlayerViewController. It uses progressive download + MoviePlayer and AVFoundation frameworks.




回答4:


To play this video you need to have the link to the video stream that is associated with video you want to play. Unfortunately this isn't so simple to get this link for some movies on YouTube since this link can be encoded for some movies (channel VEVO for example). Read this for more information about encoded links http://www.jwz.org/blog/2013/06/youtube-download-counter-countermeasures-applied/.

Unfortunattely as for now there is no simple way to decode these links. Despite this, you can get the source link for the not encoded films without bigger problems using some calls to the YouTube Api.



来源:https://stackoverflow.com/questions/18287889/playing-video-from-youtube-link-without-uiwebview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!