How to play YouTube videos without UIWebView or detect a video player when starting YouTube videos using web browsing?

I need to play youtube video in an iOS app, and during video playback I need to add an overlay to the video.

1. Now how can I run a YouTube video in my own player?

2. If I play a video in UIWebview, then how can I find out what video to play and how to add an overlay to the video?

+6
source share
2 answers

MPMoviePlayerViewController cannot directly play youtube video URLs. You need to extract the URL before loading MPMoviePlayerViewController using the URL.

you can see a working demo in my github registry:

Try the following: https://github.com/DpzAtMicRO/IOSYoutubePlayer

LBYoutubeExtractor retrieves youtube url using JSON.
Please read README.md before using this in your application.

Hi

+10
source

MPMoviePlayerViewController is good, but the last commit is a few years ago. I found another solution called "XCDYouTubeKit" that supports iPhone / iPad and iOS7 with full-screen YouTube videos.

You can go to the github page in here and the fully documented tutorial on here

This is what the official developer says on his page:

The only official way to play a YouTube video within the app is the web view and iframe API. Unfortunately, this is very slow and rather ugly, so I wrote this player to give users the best viewing experience.

+1
source

All Articles