Controls disappear when reaching end of audio only title with MPMoviePlayerController - ios

I am using MPMoviePlayerController to play audio and video on an iPad. If an audio only title (an mp3 in this case) is playing and reaches the end the playback controls disappear and there is no way to get them to show again. What I want to have happen is for the controls to stick around and for the title to be scrubbable. I did try setting the repeatMode to MPMovieRepeatModeOne but that seems to have no effect on audio only titles. I did read a post that if you were using MPMoviePlayerViewController to remove the observer for the MPMoviePlayerViewController instance but I am using MPMoviePlayerController. Any ideas would be appreciated.

Related

MPMoviePlayerController shows no picture when playing online video

I used a MPMoviePlayerController to play online video in another view controller. It works well most times. But sometimes the player plays video without pictures while the sound and progress bar are working. After the black screen occurs, if I change to play another video, it will often works well. Can someone tell me what's the problem and how can I fix it?
Try to use MPMoviePlayerController to play online video.
It is the best controller for playing online videos.

How to stop downloading a streaming HLS video after navigating away from AVPlayer view?

I am trying to play a HLS stream using AVPlayer. The player plays the stream fine, however, after navigating away from the player view, it does not seem to stop downloading data for the HLS stream. I see a network data spinner on the status bar for a few minutes after navigating away from the AVPlayer view.
I have tried cancelPendingSeeks, cancelLoading, and tried removing the AVPlayerLayer from its superlayer using removeFromSuperLayer, however, none of these seems to solve the issue — there is still a spinner on the status bar.
This spinner is seen on actual device, but there is no spinner on the simulator. I am certain the video is being downloaded; I can see the data usage in network monitoring apps. How can I fix this?
Call pause on your AVPlayer object, then replace the item with a nil item, and set your video player to nil.
[anAVPlayerObject pause];
[anAVPlayerObject replaceCurrentItemWithPlayerItem:nil];
anAVPlayerObject = nil;

Playing audio in the background when using a UIWebView

So I´ve don all the preliminary steps of setting the audioSession sharedInstance category, and activated playing audio in the background in the info.plist file
However I am using an UIWebView to display YouTube, and even thought background playing is
supported, pressing the home button the audio stops. Is this cause YouTube uses some built in player? cause when I play an video my tab bar controller disappears.
Is there a way of having it continue playing the youtube videos in background?

AVPlayer vs MPMoviePlayer

In my application I have to play videos of type .m3u8. These are not local video. I can do it either with MPMoviePlayerController or AVPlayer. I also have to ignore userinteraction when some advertisement is getting played. Also I have to give an option for Airplay.
Which player should I use?
Thanks.
AVPlayer has a subclass called AVQueuePlayer which allows you to play back several movies in a sequence. It would be helpful for you for your ads. AVplayer currently does not support Airplay.
From iOS 5 AVplayer has an option to start playing back automatically on Airplay by enabling usesAirPlayVideoWhileAirPlayScreenIsActive property (if allowsAirPlayVideo is also enabled)
As far as I know you cannot play on airplay automatically with MPMoviePlayer, user has to tap on the Airplay icon.

avaudioplayer interferes with mpmovieplayer on ipad

my app plays video and audio. however, i have a problem where once i play an audio file using avaudioplayer, the video refuses to play. when i play the video first, everything is fine. but if the audio is played first, any time i try to play the video it simply pops up the video player but will not play the actual video (you can use the scroller to go to any point in the video, but no playback will happen). this issue does not come up on the iphone, nor on the ipad simulator. clearly there is some resource conflict here, probably related to the audio, and i'd welcome some input on how to address it.
issue solved: i had to call the 'stop' rather than 'pause' method on the avaudioplayer before video playback. this undoes the play preparation and releases the audio resource that had apparently prevented the video from being played.

Resources