Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7748149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:42:29+00:00 2026-06-01T10:42:29+00:00

LoadHtmlString UIWebView is not working. I want to play embeded you tube video. I

  • 0

LoadHtmlString UIWebView is not working. I want to play embeded you tube video. I have tried with Embeded HTML string. But some seems broken i am getting white screen. i Have tried with following

NSString* html = @"<embed id=\"yt\" src=\"http://www.youtube.com/v/6eK-W32IME0?fs=1&hl=en_US&enablejsapi=1\" type=\"application/x-shockwave-flash\" width=\"330\" height=\"200\"></embed>";

NSString*html = @"<iframe class=\"youtube-player\" type=\"text/html\" width=\"320\" height=\"460\" src=\"http://www.youtube.com/watch?v=oEn9g4pNW9Y&feature=youtu.be\" frameborder=\"0\"> </iframe>";

[videoView loadHTMLString:html baseURL:nil];

But does not get success. Can any one help me ? What wrong i have done here? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:42:31+00:00Added an answer on June 1, 2026 at 10:42 am

    try

    - (void)embedYouTube:(NSString*)urls frame:(CGRect)frame { 
    
        urls=[urls stringByAppendingString:@"&autoplay=1"];
        NSString *htmlString =[NSString stringWithFormat: @"<html><head> <meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 212\"/></head> <body style=\"background:#F00;margin-top:0px;margin-left:0px\"><div><object width=\"212\" height=\"212\"><param name=\"movie\" value=\"%@\">",urls];
    
        NSString *htm2=[NSString stringWithFormat:@"</param><param name=\"wmode\" value=\"transparent\"></param>    <embed src=\"%@\"type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"212\" height=\"212\"></embed>    </object></div></body></html>",urls];
    //    NSString* embedHTML = @"<html><head> </head><body style=\"margin:0\"> <iframe title=\"YouTube video player\" class=\"youtube-player\" type=\"text/html\" width=\"%d\" height=\"%d\" src=\"%@\" frameborder=\"0\" allowFullScreen></iframe> </body></html>";  
    
        NSString* html = [NSString stringWithFormat:@"%@%@",htmlString,htm2];
        float version = [[[UIDevice currentDevice] systemVersion] floatValue];
    
    
        if(version<5.0)
        { 
    
            NSRange r=[urls rangeOfString:@"v="];
            NSRange ran=NSMakeRange(r.location+2, [urls length]-r.location-2);
            NSString *vid=[urls substringWithRange:ran];
        html=[NSString stringWithFormat:@"<embed id=\"yt\" src=\"http://www.youtube.com/watch?v=%@&fs=0\" type=\"application/x-shockwave-flash\" width=\"300\" height=\"300\"></embed>", vid];
        }
        //NSLog(html);
        if(webView == nil) {  
            webView = [[UIWebView alloc] initWithFrame:frame];  
            [self.view addSubview:webView];  
            [webView setDelegate:self];
        }  
        [webView loadHTMLString:html baseURL:nil];  
    }
    

    hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to load some HTML in a UIWebView: - (IBAction)buttonClicked:(id)sender { [webView loadHTMLString:@Hello
I'd like to use UIWebView's - (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL but I'm not sure
I want to play YouTube videos from my iPhone app. I have to tried
I'm loading a string of HTML into a UIWebView through loadHTMLString. It produces a
I want to play video in UIWebView. This video is stored in my app
I have an application with a UIWebView where I display some html content. The
i am not sure if this is a good route to go,...i have some
I got a problem with UIWebView. I want to render my own html code
I want to execute javascript code from my iPhone application using UIWebView. But only
I have made a string like this one.. NSString *loadString = [NSString stringWithFormat:@<html><body bgcolor=\red\><font

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.