views:

23

answers:

1

Hi all.

My application is streaming YouTube videos by loading a URL in a UIWebView:

NSString *videoURLStr = [NSString stringWithFormat:@"http://www.youtube.com/embed/%@?autoplay=1", videoId];
NSURL* videoURL = [NSURL URLWithString:videoURLStr];
[movieView loadRequest:[NSURLRequest requestWithURL:videoURL]]; 

This works great, except that my application has no awareness of what's going on in the movie player. For instance, I'd like to be able to make changes to my view when the movie player window opens. I'd also like to know when it closes and control returns to my application.

I've set my view as the delegate to the UIWebView, and implemented

- (void)webViewDidFinishLoad:(UIWebView *)webView

This is called after the UIWebView has loaded the wrapper code for the video, but the movie player window is not yet visible. It would seem that the movie player window becomes visible only when the movie begins playing, i.e. after enough of the movie has been buffered.

What I'm asking for may not be possible, but if anyone has any ideas I'd love to hear them.

Thanks.

A: 

if you are going to go this route then you will need to use the youtube javascript api

http://code.google.com/apis/youtube/js_api_reference.html#EventHandlers

Aaron Saunders