title: Objective-C: Play Youtube Video on App
body: <p>I am trying to explore what else can i do in iOS app development and it just now that i've tried to include a video on my app.</p>
  
  <p>I have this code below that aims to play a youtube video when the view loads, but all i got is just a black webView.</p>
  
  <pre><code>NSString *videoURL = @"http://youtu.be/Wq_CtkKrt1o";
  
  videoView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 768, 1024)];
  videoView.backgroundColor = [UIColor clearColor];
  videoView.opaque = NO;
  videoView.delegate = self;
  [self.view addSubview:videoView];
  
  
  NSString *videoHTML = [NSString stringWithFormat:@"\
               &lt;html&gt;\
               &lt;head&gt;\
               &lt;style type=\"text/css\"&gt;\
               iframe {position:absolute; top:50%%; margin-top:-130px;}\
               body {background-color:#000; margin:0;}\
               &lt;/style&gt;\
               &lt;/head&gt;\
               &lt;body&gt;\
               &lt;iframe width=\"100%%\" height=\"240px\" src=\"%@\" frameborder=\"0\" allowfullscreen&gt;&lt;/iframe&gt;\
               &lt;/body&gt;\
               &lt;/html&gt;", videoURL];
  
  [videoView loadHTMLString:videoHTML baseURL:nil];
  </code></pre>