I want to embed youtube video in webviewer whenever I click the button. I have this code
- (IBAction)testBtn:(id)sender { NSString *code = @"<iframe width=\"560\" height=\"315\" src=\"//www.youtube.com/embed/1iBIcJFRLBA\" frameborder=\"0\" allowfullscreen></iframe>"; [[self youtubeWebPlayer]loadHTMLString:code baseURL:nil]; }
My problem is that whenever I click the button, nothing happens. Web browsing remains blank.
I set breakpoints in the code to verify that the code is being called by my application and that it is actually being called.
EDIT ***
I fixed the problem by replacing
[[self youtubeWebPlayer]loadHTMLString:code baseURL:nil];
from
[[self youtubeWebPlayer]loadHTMLString:code baseURL:[NSURL URLWithString:@"http://www.youtube.com"]];
source share