0

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?

Community
  • 1
  • 1
Sonu
  • 517
  • 1
  • 4
  • 4

1 Answers1

0

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.

Yorxxx
  • 536
  • 4
  • 9
  • Thanks for your help. But MPMoviePlayerViewController is not playing you-tube video as in youtube there is no direct URL to the video....When i am trying in my iPhone simulator it shows a black screen for a while then the videoDidFinsih notification get called.Refer this http://stackoverflow.com/questions/1779511/play-youtube-videos-with-mpmovieplayercontroller. Can you please guide me how to get the topViewcontroller? – Sonu Feb 25 '11 at 08:59