How to get the reference of playing MPMoviePlayerViewController after clicking on the UIwebView

538 views Asked by At

I have loaded the you-tube URL on the UIWebView. After I click on UIWebView it opens the video in MPMoviePlayerViewController. Actually I need to get the reference of this MPMoviePlayerViewController as I need to overlay text on this video. Another problem I am facing is that I am not able to auto play the video. I tried this Youtube video autoplay on iPhone's Safari or UIWebView but doen't work for me.

Can anybody help?

1

There are 1 answers

1
Yorxxx On

Why would you use an UIWebView instead of the MPMoviePlayerViewController? I mean, the URL requested is the video itself? Then, better use the movieplayer.

Anyways if I'm not wrong, the UIWebView fails and loads the movieplayer. So check

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
 // I think this error is the 204, check it yourself

And when this happens, try getting the topviewcontroller (which should be the movieplayerview).

Not tested by myself, this is the first thing that came to my mind :P

Hope it helps.