1

So, I've read the docs and am aware of this: Multiple MPMoviePlayerControllers on iOS 3.2/4.0 (also, by docs I mean apple's)

and unfortunately debugging this is hell bc: Bootstrap Server Error in Xcode IPHONE

So every 5 or so runs I have to reboot my machine.

But the main question is, I'm loading a lot of containers (just views). Within those containers, there might be something with an MPMoviePlayerController, which I turned into a custom class. Anyway, it works, plays movies just fine.

At any given time, there may be up to three of them on the screen. (I use paging, and unload the ones that are far away). So it's possible to have 3 movies, all hooked up to downloaded data.

They play, but of course, only one at a time. Not a problem. Only one containing view is active.

When the view changes a "page" (it's a UIScrollView) I manually set the "outsiders" to inactive. Essentially, it calls "stop" on the MPMoviePickerController. This stops it, but I can't resume. The controls literally vanish, and I can't resume. (iOS Bug?)

So I called Pause instead. Same thing.

I go back to play it, and it won't play.

Here's a funny one, pause one and go to play another. Crash. Something with the AVPlayerItem not being able to play 2 at once. I've programmed custom AV movie players because of needing 2 movies or whatnot, about to do that again if this doesn't work. Anywho... why two controllers use the same player item, I can only guess Apple uses a singleton in a really bad spot.

So, apple documentation clearly states I can load as many as I want, but only play one. Unfortunately, it doesn't say how to pause them properly, 'cause the controls disappear.

Anyone aware if this is a bug? Or is there something other than pause and stop to try?

I will probably resort to the AV stuff if not. Anyway, if not for the reboots, I'd be trying some form of resume stuff this moment, trying to get an answer rather than just a question. Thanks for any tips/suggestions!

Will let everyone know if I find it

Community
  • 1
  • 1
Stephen J
  • 2,367
  • 2
  • 25
  • 31
  • Just noticed: The controls only disappear if more than one is loaded. Even after setting to inactive, the controls stay visible if another one is not there – Stephen J Apr 12 '12 at 21:55
  • 1
    You are correct with your AVPlayer singleton theory - that is a commonly understood rumor. – Till Apr 13 '12 at 01:47
  • Considering it allows full screen mode, I can see why someone would "think to put it in", but I don't understand why they actually did, unless it's supposed to create a crash if someone were to do 2 full screeners. Anyway, I solved it – Stephen J Apr 13 '12 at 18:35

1 Answers1

0

Ok, so this is an odd way of solving it, essentially doing the usual. My custom view unloads the entire controller, then sets it to nil (impossible to test for it without crashing if you don't set to nil, even with intent to reload).

So, once my view is offscreen, I send it the "unload yourself" message. It caches the name of the URL, then when I set it to active, it reloads and reallocates everything.

Everything appears fine, unfortunately I do not know what I'd do, besides place an overlay, if I had both of them on the screen. This really only looks smooth because my stuff is offscreen.

Solved for this instance. I can recommend, to anyone looking, to use the AVPlayer. It's not too hard after you understand to use layerClass to change the underlying layer, add an item, and remember to do the memory properly. Copy apple's sample code in the docs...

and prepare to mess with aspect ratios...

Thanks for the comments!

Stephen J
  • 2,367
  • 2
  • 25
  • 31