views:

372

answers:

3

I have an app with a splash screen. For the splashscreen I've decided to add a m4v movie. I'm using the MPMoviePlayerController to show the movie. Everything is working as expected except for one thing:

I'm trying to make the MPMoviePlayerController loop by subscribing to it's MPMoviePlayerPlaybackDidFinishNotification notification and issuing a [notification.object play] if the data didn't finish loading.

This works partially, it restarts the movie, but there's the fadeout and re-fadein that make it look bad.

Is there any other way to loop the movie?
Or any way to remove the fades?

A: 

I don't think there is any public option to do this. You could try and inspect Erica Sadun's Class Dumps for a method you can override that would handle the fading. Maybe a videoDidFinish method or something.

coneybeare
A: 

Have you tried messing around with the backgroundColor property? Apple's MPMoviePlayerController docs say

"The receiver fades to and from the background color when transitioning to and from playback...The default color for this property is black. You can change this to other colors (including clear) to provide a more appropriate transition from your application’s content to the movie content."

So, you can probably try setting it to [UIColor clearColor] and seeing if that helps.

refulgentis
tried that, didn't help :(
Prody
+2  A: 

By complete coincidence I have just written a blog post on this subject - we ran into this problem while we were writing our latest app :)

Assuming that you don't want to follow my shameless plug, here's how we fixed it :

  1. Make sure that the movie starts and ends on the same frame.
  2. Make the starting frame the Default.png of the app
  3. On startup add Default.png to the window as a UIImageView
  4. Make the movie have a clear background
  5. Play and loop the movie

When the movie ends, it will fade out before it loops round. As Default.png is exactly the same as the start and end frames, the user will never notice :)

When you want to end the movie just remove the Default.png UIImageView and stop the movie - as the background is clear it will just fade out to whatever ui you have in your window.

Sam

deanWombourne
Clever solution...
marcc