I'm working on application which shows movie trailer but Apple reject my application because i've no right to show trailer on application. Now i want to add IMDB movie trailers in application.
I search a lot to find IMDB SDK for iOS but failed now i find embedded Code on IMDB website which run movie trailer. Using this link:
How to embed YouTube video on iOs and play it directly on UIWebview without full screen
i'm trying to run iframe on UIWebView but it shows me white screen, if i used dailymotion or vimeo iframe then it works fine.
Here is my code:
self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 20,320, 568)];
[self.webView setAllowsInlineMediaPlayback:YES];
[self.webView setMediaPlaybackRequiresUserAction:NO];
[self.view addSubview:self.webView];
NSString* embedHTML = [NSString stringWithFormat:@"<html><body style='margin:0px;padding:0px;'><script type='text/javascript' src='http://www.youtube.com/iframe_api'></script><script type='text/javascript'>function onYouTubeIframeAPIReady(){ytplayer=new YT.Player('playerId',{events:{onReady:onPlayerReady}})}function onPlayerReady(a){a.target.playVideo();}</script><iframe src='http://www.imdb.com/video/imdb/vi2198188057//embed?autoplay=false&width=480' width='480' height='270' allowfullscreen='true' mozallowfullscreen='true' webkitallowfullscreen='true' frameborder='no' scrolling='no'></iframe></body></html>"];
[self.webView loadHTMLString:embedHTML baseURL:nil];
It doesn't work because you're mixing the YouTube iFrame player with the IMDB trailer player. Try using the YouTube trailer link: