Play a list of media (video/audio) items on iOS - ios

I'm developing an iPhone App and I need to implement a player to play a list of media (video/audio) items.
Following is a screenshot of player I have captured from an another iPhone app, I found many apps playing video/audio using a player has similar UI like this.
Can this player (including UI) can be implement by official API? Or just implement manually?
How can I implement a same player like this?

To Play audio follow this blog
And to play video, either you can use CustomMovieplayer or go with UIWebView with embedded html.
Movie Player sample code from here
To play video as embedded html in UIWebView, check this..
https://stackoverflow.com/a/7551375/790794
As per the file type, you can modify the source type.

Related

Play Youtube Url In Webview without userControl in iOS

I want to play youtube url in UIWebview or MPMoviewviewcontroller.but the restriction is user should not control the playing video.could any one help ?
If you want finer control over youtube videos, theres a library (not written by me) called XCDYoutubeKit. Search for that and look at incorporating it into your app - theres a class in there that is based on MPMoviePlayerController, that allows the playing of youtube videos from their youtube id (I use it, its good). This also means you get a normal player, so you can pause, scrub through, etc.

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.

How to play a youtube video list in ios natively

I need to play youtube video lists in an iphone app. I did a quick research but still could not find the answer. Most of the answers out there are about playing a single youtube video in iOS by embedding a youtube url in a HTML page and load it in a UIWebview. But it doesn't seem to be the way for playing a list. But I guess it's possible because there are apps that can do that.
Update: I managed to play a list in a UIWebView with iframe method, but it not what i set out to do. I need to play the video not in a full screen mode. Is there anyway to do so?
Thanks
Using UIWebView's internal MPMoviePlayerController, it may be possible to load the videos one by one by storing their URLs in an array and incrementing the array's object position when the finish event is sent internally by the iFrame's javascript. iFrame methods are documented here, and a way to inject a webview with javascript is shown here.
As for non-inline video playing (only fullscreen), set allowsInlineMediaPlayback to NO on the UIWebView.

Resources