My application broadcasts a YouTube video by loading a URL into 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 does not know what is going on in the movie. For example, I would like to be able to make changes to my presentation when the video player window opens. I would also like to know when it closes and controls the return to my application.
I set my view as a delegate in UIWebView and implemented
- (void)webViewDidFinishLoad:(UIWebView *)webView
This is called after UIWebView has loaded the shell code for the video, but the video player window is not yet visible. It would seem that the video player window becomes visible only when the movie starts playing, i.e. After enough buffer buffer.
What I am asking for may not be possible, but if anyone has ideas, I would like to hear them.
Thank.
source
share