how to know that MPMoviePlayerController is playing in Iphone OS 3.0

邮差的信 提交于 2020-01-03 19:35:45

问题


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:


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?




回答2:


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



来源:https://stackoverflow.com/questions/2085311/how-to-know-that-mpmovieplayercontroller-is-playing-in-iphone-os-3-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!