- Get link
- Other Apps
#pragma mark - UIWebViewFactory
+ (UIWebView *)youtubePlayerViewWithFrame:(CGRect)frame andURLString:(NSString *)URLString {
UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame];
videoView.backgroundColor = [UIColor clearColor];
videoView.opaque = NO;
NSString *videoHTML = [NSString stringWithFormat:@"\
<html>\
<head>\
<style type=\"text/css\">\
iframe {position:absolute; top:0; margin-top:0px;}\
body {background-color:#000; margin:0;}\
</style>\
</head>\
<body>\
<iframe width=\"%0.0f\" height=\"%0.0f\" src=\"%@\" frameborder=\"0\" allowfullscreen></iframe>\
</body>\
</html>", frame.size.width, frame.size.height, [ACMUtility youtubeEmbededURLStringFromURLString:URLString]];
[videoView loadHTMLString:videoHTML baseURL:nil];
return videoView;
}
How to call this method:
UIWebView *videoView = [CommonClass youtubePlayerViewWithFrame:view.bounds andURLString:attrib.source];
videoView.tag = 2;
[view addSubview:videoView];
Comments
Post a Comment