views:

681

answers:

2

Hi everyone!

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!

+1  A: 

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?

cidered
I can't tell all user to upgrade to 3.1. :(
mxg
edited my answer with possible workaround. I don;t like it but can't find anything else that works!
cidered
+4  A: 

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

JOKe
Maybe I'm being stupid because this answer has been upvoted 3 times- but how can I call the [.. play] method from the MPMoviePlayerContentPreloadDidFinishNotification if the notification is never fired? Could you please elaborate? Thanks
Sam
I mean I don't call play beforehand and it still doesn't work
Sam