1

I am trying to embed youtube video in my app and I am using this function

- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame {
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: white;\
}\
</style>\
</head><body style=\"margin:0\">\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
NSString *html = [NSString stringWithFormat:embedHTML, urlString, frame.size.width, frame.size.height];
UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame];
[videoView loadHTMLString:html baseURL:nil];
[self.view addSubview:videoView]; }

also I am calling like that :

[self embedYouTube:@"http://www.youtube.com/watch?v=5ABkqmqiYEI" frame:CGRectMake(30, 200, 260, 200)];

But when I run the app it gives me white empty box .

here is my question : how to make sure that the embed working probably ?

Clifford
  • 88,407
  • 13
  • 85
  • 165
Ali Alzahrani
  • 529
  • 1
  • 6
  • 29

0 Answers0