How to play YouTube video without leaving app on iOS 7 - ios

Is it possible to play YouTube video without leaving app on iOS 7?
I tried LBYouTubeView but it does not work on iOS 7.

To play YouTube video you have to extract the youtube URL from the youtube videoID. there are lots of API available that extract this
XCDYouTubeKit
HCYoutubeParser
Another way to play youtube videos is WebView.
But you should not go for this because using this your application will be rejected.
The best way to play youtube videos is the Webview

Related

Play YouTube or Vimeo Video on iOS fullscreen and without WebView

I know there are various libraries and approaches to play Youtube or Vimeo videos on iOS inside WebViews. Is there a way to play such a video without the use of a WebView at all? All I want to do is have my own "show video" button and when it's pressed then the default fullscreen video player on iOS should open and play the video from YouTube or Vimeo. Is that possible?
You can try with
https://github.com/0xced/XCDYouTubeKit
as reported in this thread:
How to embed a Youtube video into my app?

Unable to play youtube video on iOS

I am using YTPlayerView to play a YouTube video on iOS.
However, I get the error message seen below for some videos and am unable to play them on an iPhone.
This video contains content from Panorama. It is restricted from playback on certain sites
What can be the possible issue ?
I got the answer. All i had to do is to enable Allow embedding in Distribution Option in Advance settings of video.

Playing Vimeo Videos with Custom Video Player in iOS

I have to play Vimeo videos in my iOS application using a video player. I need to log events like play, pause, seek etc. Its not possible to play using MPMoviePlayerController or AVPlayer as Vimeo videos have flash content. I am able to play using UIWebView. But, it is showing default Vimeo player controls. I need to have my own controls to play, pause etc as I need to log those events.
I have tried for lot of solutions. Nothing worked. If anyone knows how to play Vimeo videos using custom player. Please Let me know.
I am able to find out solution for this problem. I have used YTVimeoExtractor present here.
Its README.md file says following :
YTVimeoExtractor helps you get mp4 urls which can be use in iOS's native player. You can even choose between mobile, standard and high definition quality.
YTVimeoExtractor doesn't use UIWebView which makes it fast and clean.
I have used MKMoivePlayerViewController and its notifications - MPMoviePlayerPlaybackStateDidChangeNotification and ˚ notifications to get stop, pause events.
The only official way to use a player besides the Vimeo player to play Vimeo videos is to use third-party player urls provided to PRO members: https://vimeo.com/s/adg

Playing youtube videos on iOS

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?
BTW I need autoplay which I couldn't achieve with UIWebView, that's why i was wondering.
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.

How to play youtube video without UIWebView or detect video player when youtube video start playing using webview?

I need to play youtube video in my iOS application and while video is playing I need to add an overlay on video.
1.Now how can i run youtube video in native player?
2.if I play video in UIWebview then how can i detect that video is
playing and how to add overlay on the video?
MPMoviePlayerViewController cannot directly play youtube video urls.You need to extract the url before loading MPMoviePlayerViewController with the url.
you can see a working demo in my github repo:
Try this::
https://github.com/DpzAtMicRO/IOSYoutubePlayer
LBYoutubeExtractor extracts the youtube Url with JSON.
Please do read the README.md before you use this in your application.
Regards
MPMoviePlayerViewController is a good one but last commit is years ago. I found another solution called 'XCDYouTubeKit' which supports iPhone/iPad and iOS7 onwards with full screen YouTube video.
You can access github page at here and fully documented tutorial at here
This is what official developer says in his page:
The only official way of playing a YouTube video inside an app is with a web view and the iframe player API. Unfortunately, this is very slow and quite ugly, so I wrote this player to give users a better viewing experience.

Resources