Need youtube audio to continue to play when iOS app enters background - ios

My app has a UIWebView that plays specific youtube content within the app. Some of these videos can be lengthy and are more audio centric (e.g. lectures and/or music). I'd like users of the app to be able to leave the app but have the audio of the youtube video continue to play, without the need for hitting a resume or play button. How can this be done? I'm willing to abandon the UIWebView if there is a better alternative.
Thank You.

I work on the same troube. The problem come from the mpmovieplayer which play the movie in ios.
An article of Matt Gallagher said:
"This pause is sent from the CALayer displaying the video frames. This is a private class for an MPMoviePlayerController and is your own AVPlayerLayer for an AVPlayer."
source - http://www.cocoawithlove.com/2011/04/background-audio-through-ios-movie.html
This article is very old (2011), but maybe the problem is similar.
Good luck

Related

Play Audio from URL ios

I am developing application like gaana.com
Which player can be used for play mp3 songs from server url ? I want
to implement Play, Pause, Next, Previous buttons And will also play
song list in background mode one by one.
I have already implemented AVPlayer but i getting issue in playing
next audio in background mode. And i had tried all answers regarding
this issue but none of all is working for me.
So i am finding alternative of AVPlayer.

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

Display youtube video that contains content protected by copyright

I am making a scroll view in which there are multiple instances of UIWebView, each with a youtube video that user can tap and watch. I tried multiple approaches how to this (I mean, what to put in UIWebView), the one that worked best was from https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player
However, I have a video that doesn't play, instead it displays "This video contains content from SME. It is restricted from playback on certain sites" (it worked fine at first and I wasn't getting this message, no idea why it stopped working). Is there a way to make such video play in iOS app? If yes, how?
P.S.
I don't want to kick the user out of my app and send him to youtube app or safari.
I also want to be able to count how many times did user play the video, but this topic is probably big enough for a separate question.
Try loading video with this:
[_videoWebView loadHTMLString:html baseURL:[NSURL URLWithString:#"http://www.youtube.com/"]];

Use iPhone's multitasking music controls in an app

I've searched the Internet for a while to try and find an answer to this. If you open up the multitasking bar and swipe to the left there are music controls that can be used by whatever app is playing music (ie Music, Pandora, etc.). I have not yet discovered a way to use these in my own music playing application. Does anyone know how to do that?
You should take a look at this example in the Apple API docs examples. It's basically what you want, a small audio player that interfaces with iTunes, lets you pick songs from the library and behaves much like the standard music player, including the music controls callbacks.

Resources