- (void)embedYouTube:(NSString*)url frame:(CGRect)frame {
NSString *htmlString = [NSString stringWithFormat:<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=\"100\" height=\"100\">\
<param name=\"movie\" value=\"%@\"></param>\
<param name=\"wmode\" value=\"transparent\"></param>\
<embed src=\"%@\"\
type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"100\" height=\"100\"></embed>\
</object></div></body></html>",url,url];
webView = [[UIWebView alloc] initWithFrame:frame];
webView.delegate = self;
[webView setScalesPageToFit:TRUE];
[webView setContentMode:UIViewContentModeTop];
[self.view addSubview:webView];
[webView loadHTMLString:htmlString baseURL:nil];
}
I have implemented above code. It works fine on iPhone, but on iPad I just hear the audio, the video is not displayed.
How can I make this work on both types of devices?
I got solution after working more then two days…
Solution is that I need to add controller in view not same as iphone.
But remember one thing just write this two line while dismissing view.