Iphone – MPMoviePlayerController fullscreen movie inside a UIWebView

iphonempmovieplayercontrolleruiwebview

I'm having a problem with the UIWebView and MPMoviePlayerController:
My UIWebView have a movie inside the html (it's a local html file), I'm using html5 and a video tag for the video.
The problem is: the user can set the video to play inline, directly on the html or he can tap the fullscreen button, but I need to know if the video is playing fullscreen.

I've tried to use MPMoviePlayerDidEnterFullscreenNotification but with no success.

Does anybody know how to get this notification from the webview?

Thanks in advance

Best Answer

There is no notification being sent (also see this post: Event on view displayed change (Youtube MPMoviePlayerViewController)), but the web view will do something hackish: it will add a subview to the root UIViewController's view, make it full screen and play the movie there.

Make your main UIViewController's view a view of your own, and intercept -didAddSubview: and -willRemoveSubview:. This way you'll be able to detect when the player is brought fullscreen.

Related Topic