开发者

iOS how to directly play youtube videos without embedding it in a UIWebView

开发者 https://www.devze.com 2023-03-12 00:16 出处:网络
I want to add a youtube video play functionality to my iPhone app. But I dont want to embed it in a UIWebView,

I want to add a youtube video play functionality to my iPhone app. But I dont want to embed it in a UIWebView,

Basically I want to remove an extra view before video is played. I want a user to see the video as开发者_如何学运维 soon as he taps on (say) a UITableViewCell.

Is this possible??

I have seen this post: Embedding YouTube videos on But that is not the solution I want.

Also if I launch Youtube application directly, users wont be redirected to the app. after video is completed.

Thanks in advance.


You could use XCDYouTubeVideoPlayerViewController. It is a 3rd party YouTube library. https://github.com/0xced/XCDYouTubeVideoPlayerViewController

From their Readme:

Keep in mind that XCDYouTubeVideoPlayerViewController uses progressive download, so remember that some restrictions apply if you submit your app to the App Store, as stated in HTTP Live Streaming — Requirements for Apps:

Warning: iOS apps submitted for distribution in the App Store must conform to these requirements.

If your app delivers video over cellular networks, and the video exceeds either 10 minutes duration or 5 MB of data in a five minute period, you are required to use HTTP Live Streaming. (Progressive download may be used for smaller clips.)


I have never used youtube apis, but i suppose you can access the underlying movie file url. If you can (and the video is plain h264) you can stream directly to the device using MPMoviePlayerController and friends.

0

精彩评论

暂无评论...
验证码 换一张
取 消