In my iPhone app, I'm presenting a modal view controller from a home screen with a UIWebView that displays an "inline" embedded YouTube video using this:
UIWebView *youTubeWV = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 220)];
[youTubeWV loadRequest:[NSURLRequest requestWithURL:sourceURL]];
//NSString *youTubeVideoHTML = [NSString stringWithFormat:@"<embed id=\"yt\" src=\"http://www.youtube.com/watch?v=CadgUJRZfEE\" type=\"application/x-shockwave-flash\" width=\"320\" height=\"220\"></embed>"];
NSString *youTubeVideoHTML =@"<html><head>"
"<meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 220\"/></head>"
"<body style=\"background:#FFFFF;margin-top:0px;margin-left:0px\">"
"<div><object width=\"320\" height=\"220\">"
"<param name=\"wmode\" value=\"transparent\"></param>"
"<embed src=\"http://www.youtube.com/v/W-nzUoaI2Ss?f=user_favorites&app=youtube_gdata\""
"type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"320\" height=\"220\"></embed>"
"</object></div></body></html>";
[youTubeWV loadHTMLString:youTubeVideoHTML baseURL:nil];
[self.view addSubview:youTubeWV];
The video is displayed without problem in the modal view "quicktime player" that shows. However, when I tap "Done" to close the second modal, I get kicked back to the very first screen, bypassing my first modal view. And in my home screen, now all the buttons don't work. Strange!
UPDATE: I removed the modal transition from my home screen and made it a "pushViewController" instead, and now everything functions properly. So it's an issue of the YouTube player dismiss 2 modals at the same time. How can this be fixed?
Any ideas?