I have successfully implemented embedded vimeo videos into my app, however i would like to create placeholder images as an overlay on the videos whilst they are not playing. Does anyone have an idea of how to do this?
#import "FifthDetailViewController.h"
@interface FifthDetailViewController (Private)
- (void)embedVimeoInWebView:(NSString *)urlString webView: (UIWebView *)aWebView;
@end
@implementation FifthDetailViewController
@synthesize toolbar;
@synthesize videoOne;
#pragma mark -
#pragma mark View lifecycle
- (void) viewDidLoad{
[super viewDidLoad];
[self embedVimeoInWebView:@"http://player.vimeo.com/video/19967404" webView:videoOne];
}
- (void)embedVimeoInWebView:(NSString *)urlString webView:(UIWebView *)aWebView {
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: white;\
}\
</style>\
</head><body style=\"margin:-2\">\
<iframe src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"%0.0f\" height=\"%0.0f\"></iframe>\
</body></html>";
NSString *html = [NSString stringWithFormat:embedHTML, urlString, aWebView.frame.size.width, aWebView.frame.size.height];
//UIWebView *aWebView = [[UIWebView alloc] initWithFrame:frame];
[aWebView loadHTMLString:html baseURL:nil];
//----Disable Scroll UIWebView----
[[[aWebView subviews] lastObject] setScrollEnabled:NO];
//[mainView addSubview:aWebView];
//[self.mainView addSubview:videoView];
[aWebView release];
}
- (void)dealloc {
[toolbar release];
[super dealloc];
}
@end
This is what i have so far.
The approach we took with youtube videos is as follow (I guess you can do something similar with vimeo).
What you need to do is set an imageview on top the webview, which should display the thumbnail img of your vimeo video (this is what I understand from your question).
You can retrieve thumbnail images with Vimeo API
You’ll get three thumbnails, one for different size (small, medium, large).
Since your imageView will hide the webview and the button on it to start playing, you will need to perform an action when you tap the uimageview (or just set an uibutton on top). Then, the selector should call something like this: