Youtube video embed in WebView and MoviePlayer control

Posted by Tronic on Stack Overflow See other posts from Stack Overflow or by Tronic
Published on 2011-01-17T07:21:15Z Indexed on 2011/01/17 7:53 UTC
Read the original article Hit count: 311

Filed under:
|
|
|
|

hi,

i embed a youtube video into a webview. the problem is: when i pop the current view (which includes the webview) from navigation controller, the the movie itself stops, but the audio is continues running. when i push the view controller on the navigation controller again, i can play the movie newly, but the old audio is still there.

my webview code

ids_ = [NSArray arrayWithObjects:@"2b84g38Z_60",@"3URx0tM-rMc",@"HZpi-2HVhq0",@"Hhns0DRPI44",@"hRuoxRQ4Q3k",@"lkMXwNBGRA8",@"tXGc6wWIFJo",@"uzGdEn8aW-Q",@"ZAoEBdt8C5M",@"vn8EJqt2BvQ",@"7Z_qRbjG6Ck",@"JspRcxGUijs"@"lM2lcVOh5YU",@"2b84g38Z_60",nil];

int numIds_ = [ids_ count];

NSLog(@"%d", arc4random()%numIds_);

NSString *youTubeVideoHTML = [[NSString alloc] initWithFormat:@"<html><head></head><body style=\"margin:0;background-color:#000;\"><iframe class=\"youtube-player\" type=\"text/html\" width=\"640\" height=\"365\" src=\"http://www.youtube.com/embed/%@\" frameborder=\"0\"></iframe></body></html>", 
                          [ids_ objectAtIndex:arc4random()%numIds_]];

NSLog(youTubeVideoHTML);

[youtubeView loadHTMLString:youTubeVideoHTML baseURL:nil];

thanks in advance

© Stack Overflow or respective owner

Related posts about ipad

Related posts about SDK