Skip to main content

objective c - youtube video embed in iphone app but giving me white empty box -


i trying embed youtube video in app , using 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 calling :

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

but when run app gives me white empty box .

here question : how make sure embed working ?

objective c - youtube video embed in iphone app giving me white empty box - stack overflow

learn, share, build

each month, on 50 million developers come stack overflow learn, share knowledge, , build careers.

join world’s largest developer community.

sign up

i trying embed youtube video in app , using 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 calling :

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

but when run app gives me white empty box .

here question : how make sure embed working ?

share|improve question
    
does work if create html page , load in safari? – logancautrell jul 7 '12 @ 0:26
    
no, how saying ? – ali alzahrani jul 7 '12 @ 0:31
1  
create webpage on web server contains same code , open in safari. locally simulator – logancautrell jul 7 '12 @ 0:31
1  
possible duplicate of embedding youtube videos on ios – borrrden jul 7 '12 @ 1:25
    
thank , tried in iphone , work .. – ali alzahrani jul 7 '12 @ 2:41

your answer

 
discard

posting answer, agree privacy policy , terms of service.

browse other questions tagged or ask own question.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -