Advertisement
arkader

UIWebView Youtube embed

Jul 11th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -(void)playYoutubeVideo{
  2.     //*
  3.     NSString *html = [NSString stringWithFormat: @"\
  4.                      <html><head>\
  5.                      <style type=\"text/css\">\
  6.                      body {    background-color: transparent;\
  7.                      color: white; \
  8.                      margin: 0;\
  9.                      padding: 0;\
  10.                      }\
  11.                      </style>\
  12.                      </head><body style=\"margin:0\">\
  13.                      <iframe class=\"youtube-player\" width=\"%0.0f\" height=\"%0.0f\" style=\"width:320px; height:215px; position:absolute; top:0; left:-11px;\" src=\"http://www.youtube.com/embed/Jngrq0Q-YY4\" frameborder=\"0\" allowfullscreen=\"true\"></iframe>\
  14.                      </body></html>",320.0, 215.0];
  15.    
  16.    
  17.    
  18.    
  19.     //self.theFilmWebView.backgroundColor = [UIColor clearColor];
  20.     self.theFilmWebView.opaque = NO;
  21.     self.theFilmWebView.hidden = NO;
  22.     [self.theFilmWebView loadHTMLString:html baseURL:nil];
  23.        
  24.     self.theFilmWebView.scrollView.scrollEnabled = NO;
  25.     [self.view addSubview: self.theFilmWebView];
  26.    
  27.    
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement