Embed youtube video in IOS8 does not fill Webview width 100%

I have used the following code to show youtube video on iOS.

// Html string to display embedded youtube video in native webview

NSString *embedHTML = @"\
                    <html><head>\
                    <style type=\"text/css\">\
                    body {\
                    background-color: transparent; background:none;\
                    }\
                    </style>\
                    </head><body style=\"margin:0\">\
                    <embed src=\"%@\"\
                    type=\"application/x-shockwave-flash\" width=\"%0.0f\" height=\"%0.0f\"></embed>\
                    </body></html>";
                    NSString* html = [NSString stringWithFormat:embedHTML, http,viewRect.size.width, (viewRect.size.height*-1)];
                    videoView = [[UIWebView alloc] initWithFrame:CGRectMake(viewRect.origin.x , (viewRect.origin.y + viewRect.size.height), viewRect.size.width, (viewRect.size.height*-1))];
                    videoView.delegate = self;

                    //Stop Image Move
                    [videoView.scrollView setScrollEnabled:NO];
                    [self addSubview:videoView];
                    [videoView loadHTMLString:html baseURL:nil];
                    videoView.opaque = NO;
                    [self bringSubviewToFront:videoView];

      

I assigned the same width and height for both the web view and inline tag. Earlier in iOS7, this code works without issue. But in iOS8, the width of the YouTube video does not fill the webview. Please, I can really help if someone advises this issue.

Thanks in advance.

+3
youtube ios8 webview embed


source to share


No one has answered this question yet

Check out similar questions:

2263
How to get YouTube video thumbnail using YouTube API?
232
Embed YouTube video
112
Lose YouTube video flexible width
46
Unable to display HTML string
12
How to show a div over a Youtube video (z-index)?
1
Embed YouTube: Dimensions
0
How to set max width using CSS on javascript video player in Android WebView?
0
Play YouTube on iOS 5 without exiting the app
0
How to display YouTube videos?
0
Youtube full width



All Articles
Loading...
X
Show
Funny
Dev
Pics