Follow by Email

Search This Blog

Saturday, 12 July 2014

Play Youtube video in webview with HTML

Copy and Paste below code and load in your webview:

NSURL *myURL =[NSURL URLWithString:@"http://www.youtube.com/v/zah99ETVOz4"];

NSString *embedHTML = @"<html><head><meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 212\"/></head><body style=\"background:#F00;margin-top:0px;margin-left:0px\"><div><object width=\"212\" height=\"172\"><param name=\"movie\" value=\"%@\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"%@\"type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"320\" height=\"270\"></embed></object></div></body></html>";

NSString *html = [NSString stringWithFormat:embedHTML, myURL,myURL,myURL];





[YourWebView loadHTMLString:html baseURL:nil];

No comments:

Post a Comment