MPMusicPlayerController buffering / preloading - iphone

Is there a way to make MPMusicPlayerController buffer content before I call -play? Or does it do this by default when you set a queue? AVAudioPlayer has the -prepareToPlay method and I've heard that AVQueuePlayer starts buffering the next item automatically, but does MPMusicPlayerController have the same behaviour?

The answer to this question is in the iOS 6 beta docs, if anyone is wondering. Can't say much more because of NDA.
EDIT: As requested, since the NDA has been lifted, here's the answer: As of iOS 6, MPMusicPlayerController, like MPMoviePlayerController implements the MPMediaPlayback protocol, which has methods like -prepareToPlay.

Related

AVAudioPlayer or MPMusicPlayerController for playing simentanously & in background

I have the following needs to audio: it needs to be able to play at least 2 local audio files and it need to support playing in the background, so the user can close the app and multitask while the audio still plays. What of the 2 options are the best bet?
AVAudioPlayer is your best bet. As mentioned in the comment "AFAIK MPMusicPlayerController is used for local files inside the iPod Library."
Having said that, can you please give more details about your problem?

Show subtitles in a MPMoviePlayerViewController by default

Is there any way to show subtitules on a movie loaded by MPMoviePlayerViewController by default?? The movie has subs embed in the video.
Thank you!
Unfortunately this feature is missing in the MPMoviePlayer playback classes. This is obviously rather annoying, and you should consider filing a feature request with Apple. You can use the AVPlayer class instead, which as a .closedCaptionDisplayEnabled property: the downside is it's somewhat more complicated to use and only available on iOS 4.0+.

Is it Possible to Have own scrubber for MPMoviePlayercontroller

I want to play videos. I am using MPMoviePlayer, but I don't want to use the controls provided by MPMoviePlayer. So I am trying to create my own custom controls. All the functionality like play, pause, fullscreen, forward, backward are done. The only problem is with the scrubber. I am having one UISlider but I don't know how exactly work with this. How to track the currently playing video time? How to play video from where I will slide the thumb of slider?
If anyone knows this kindly help me in this.
Thanks in advance.
I was having a similar problem. I figured out how to create custom movie controls and put it up on github. Let me know if that helps. Feel free to ask me any questions if you want details.
First, we should note that all of this is possible in iOS 3.2+, if you are OK not to support iOS 3.1.x.
In iOS 3.2+, MPMoviePlayerController implements the MPMediaPlayback protocol, meaning that it responds to play, stop, etc., all the controls you would expect -- sounds like you already have some of this working. Please see the reference for the MPMediaPlayback protocol.
To get the MPMoviePlayerController to stop showing its own controls, do this on initialization:
yourPlayer.controlStyle = MPMovieControlStyleNone;
Finally, to get the scrubber to work, you need to set the UISlider valueChanged: callback to something, and update the value of currentPlaybackTime property. If you want to seek 10 seconds in:
yourPlayer.currentPlaybackTime = 10;

Get the current position of a played movie (MPMoviePlayerController currentPlaybackTime doesn't work)

hopefully someone has an answer - I am searching now for hours.
I want to get the position of an movie.
I tried it with MPMoviePlayerController, but this class doesn't support the MPMediaPlayback property called "currentPlaybackTime".
(the funny thing is, that the MP Music PlayerController has this property)
Therefore I can't get the position in my video. Is there another way to do it???
Thank you very much in advance!
MPMoviePlayerController conforms to the MPMediaPlayback protocol, and does have a currentPlaybackTime property available. However, I believe that the currentPlaybackTime property was introduced in 3.2, so it may not be available to you if you're trying to develop on a pre-3.2 device.

how to know that MPMoviePlayerController is playing in Iphone OS 3.0

I need to know if at an specific moment the MPMoviePlayerController is playing.
In iphone 3.0 it is not firing the MPMoviePlayerContentPreloadDidFinishNotification.
Does anyone knows any solution?
Thanks in advance!
So thanks for the answer.
I fix this so I will post the answer.
The answer is that MPMoviePlayerContentPreloadDidFinishNotification is NOT FIRED if you invoke play() right after the initialization.
To have MPMoviePlayerContentPreloadDidFinishNotification which works ok you have to invoke the "play()" method of the MPMoviePlayerController when the MPMoviePlayerContentPreloadDidFinishNotification is fired ( I mean in the MPMoviePlayerContentPreloadDidFinishNotification method ). In this case it always works.
Tested on 3.0, 3.1 and 3.1.2
Same question (but no answer) here and several other reports can be found on other sites (e.g. here)
Not ideal, but it seems targeting 3.1 solves the problem.
A workaround maybe to set the MPMoviePlayerController property scalingMode to something other than the default MPMovieScalingModeAspectFit ( e.g. MPMovieScalingModeNone and make sure your video is correct size) before calling play and then hook the MPMoviePlayerScalingModeDidChangeNotification event instead. it seems to get called (more than once!) as soon as the movie starts playing. Of course it will also be called if the user changes the scaling mode manually, so code for this. It's dirty but may help you?