Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Is Youtube Video Not Filling UiWebView?

I'm a noob to iphone development and I am having trouble displaying an embedded youtube video within a UIwebview. Currently, the youtube video sits in the top left hand corner of the uiwebview and it also has an annoying border. I set the youtube frame to the same dimensions as my uiwebview and the webview is set to "scale to fit". How do I make my youtube content fit the entire screen and get rid of the border? Any help is greatly appreciated.

MY CODE

NSString *video_ID = youtubeid;
NSString *htmlStr = [NSString stringWithFormat:@"<iframe class=\"youtube-player\" type=\"text/html\" width=\"320\" height=\"230\" src=\"http://www.youtube.com/embed/%@\" frameborder=\"0\"></iframe>",video_ID];
[videoScreen loadHTMLString:htmlStr baseURL:nil]; 

EDIT

 NSString *video_ID = youtubeid;
NSString *htmlStr = [NSString stringWithFormat:@"<iframe class=\"youtube-player\" type=\"text/html\" width=\"100%\" height=\"100%\" src=\"http://www.youtube.com/embed/%@\" frameborder=\"0\"></iframe>",video_ID];
[videoScreen loadHTMLString:htmlStr baseURL:nil]; 
like image 386
B. Money Avatar asked Mar 18 '13 18:03

B. Money


1 Answers

Have u tried this......

NSString *video_ID = youtubeid;
NSString *htmlStr = [NSString stringWithFormat:@"<iframe class=\"youtube-player\" type=\"text/html\" width=\"100%%\" height=\"100%%\" src=\"http://www.youtube.com/embed/%@\" frameborder=\"0\"></iframe>",video_ID];
[videoScreen loadHTMLString:htmlStr baseURL:nil];

Note That %% is used for % character.

like image 168
NULL Avatar answered Oct 01 '22 21:10

NULL