How do I download a youtube video in iOS

安稳与你 提交于 2020-01-02 11:26:33

问题


I know how to launch a youtube video within an iOS web view, but how can I download that video to save on my iPad app? Is it possible? Do I need to use some call with a NSURLConnection object and then save the received data into the proper file format?

One specific point I am unsure about is what the url to request the file would be. When viewing a video on youtube, the downloadable videos are triggered with a button, so it's not evident to me what the url would be.


回答1:


You would need to download an iOS-compatible version of the video, possibly using the same technique employed by the Safari FlashToHTML5 plugin.

Youtube DOES offer video download links:

http://lifehacker.com/#!5152236/youtube-offers-official-downloads-and-purchases-for-videos

.. make sure you do not violate their TOS.

In general, when downloading large files, you might consider implementing resumable file downloads, especially because connectivity on a mobile device is transient.

On top of that, make sure that you're on a wifi network when downloading (or resuming a download), using Reachability. Note that excessive bandwidth usage over cellular networks is a reason for app rejection.



来源:https://stackoverflow.com/questions/5807698/how-do-i-download-a-youtube-video-in-ios

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