iOS - playing a youtube video from a webview thumbnail

Posted by soleil on Stack Overflow See other posts from Stack Overflow or by soleil
Published on 2012-09-04T15:36:18Z Indexed on 2012/09/04 15:38 UTC
Read the original article Hit count: 249

Filed under:
|
|
|

Was about to finally submit an app when I realized that the youtube videos I'm playing play from the iPhone, but not the iPad. Here's the code I'm using:

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, [videoItem objectForKey:@"URL"], thumb.frame.size.width, thumb.frame.size.height];
            UIWebView *videoView = [[UIWebView alloc] initWithFrame:thumb.frame];
            [videoView loadHTMLString:html baseURL:nil];
            [videoContainer addSubview:videoView];

Is there any reason this would work on the iPhone and not the iPad? I'm testing on a 1st generation iPad. The videos play on both iPhone models I've tested (3GS and 4S).

Nothing happens at all when I tap on the webviews on the iPad.

© Stack Overflow or respective owner

Related posts about html

Related posts about ios