-5

There is a syntax error in the following code:

[videoView loadHTMLString:videoHTML baseURL:nil];

statement of this code but i m unable to get it.

- (void)embedYouTube {

    videoHTML = [NSString stringWithFormat:@"\
             <html>\
             <head>\
             <style type=\"text/css\">\
             iframe {position:absolute; top:50%%; margin-top:-130px;}\
             body {background-color:#000; margin:0;}\
             </style>\
             </head>\
             <body>\
            <iframe width=\"560%%\" height=\"315px\" src="http://youtube.com/embed/-0Xa4bHcJu8" frameborder="0" allowfullscreen></iframe>\
             </body>\
             </html>", videoURL];

             [videoView loadHTMLString:videoHTML baseURL:nil];

}
1
  • The difference in syntax markup around src="http doesn't look familiar? Perhaps your code is missing something there? Commented Aug 15, 2012 at 17:29

1 Answer 1

4

You need to escape the quotes around the URL and the frameborder:

src=\"http://...
Sign up to request clarification or add additional context in comments.

4 Comments

fixed that but now getting message for this statement </html>", videoURL]; Message is Data argument not used by format string.
@user1452248 yes, because you don't reference it at all in the format string - what are you trying to use it for?
So in place of videoURL i need to give the actual address of youtubevideo
@user1452248 then use ... src=\"%@\"", videoURL]; - but frankly, didn't you take any time to have a look at NSString's documentation?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.