views:

648

answers:

3

Hi, 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

+1  A: 

If you are embedding your movie in a web view using HTML, then you'll need to address your movie using Javascript rather than the MPMoviePlayer class.

Take a look at Apple's scripting guide for Quicktime here:-

http://17.254.2.129/safari/library/documentation/QuickTime/Conceptual/QTScripting_JavaScript/QTScripting_JavaScript.pdf

I think the property you require is GetRectangle() which returns a string of the location and dimensions of the movie within the embed area.

Once you have the dimensions, you can pass it back into Objective-C from Javascript.

Purpletoucan
A: 

There is no notification being sent, 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.

fpillet