1

i am trying to embed YouTube video into a UIView, but i can't figure out why there is this white border on the top left of the video. I also set frameborder = 0. There shouldn't be any white borders.

Here is the code for the embed youtube video: I tried it for both UIWebview and UIView... Still the same result...

NSString *embedHTML = @"<span style=\"background-color: #fdeee0;\"><iframe width=\"256\" title=\"YouTube video player\" src=\"http://www.youtube.com/embed/KzN6XWDEmXI?HD=1;rel=0;showinfo=0;controls=1\" height=\"200\" frameborder=\"0\"></iframe>";


    [testWeb loadHTMLString:embedHTML baseURL:nil];
    testWeb.scrollView.scrollEnabled = NO;
    testWeb.scrollView.bounces = NO;
testWeb.contentMode = UIViewContentModeScaleAspectFill;

[test setImage:image];
//[self.view addSubview:test];
self.testView.backgroundColor = [UIColor orangeColor];
[self.testView addSubview:test];
[self.testView addSubview:testWeb];

Here is a screenshot:

enter image description here

enter image description here

Jomoka
  • 157
  • 2
  • 15

1 Answers1

1

testWeb.scalePageToFit = YES;

http://developer.apple.com/library/ios/documentation/uikit/reference/UIWebView_Class/Reference/Reference.html#//apple_ref/occ/instp/UIWebView/scalesPageToFit

Dave
  • 7,552
  • 4
  • 22
  • 26
  • It made the YouTube video really tiny. :X Screenshot above – Jomoka Feb 05 '13 at 06:50
  • 1
    Hi Dave, thanks a lot. I just realized a stupid mistake. The width and height was in pixel mode thats why it was so small. All i had to do was get it to the right size. T – Jomoka Feb 11 '13 at 19:58
  • I have the same issue. Would you care to elaborate how you fixed it? – leolobato Aug 14 '13 at 13:01