Hi all,
I am using webkit to display youtube videos on iOS4. Upon click on the video it should automatically launch the player and display the video, but what's happening is video is rendered in the player but under the webview. What I want to do is make webview's alpha 0 so I'm using delegate
webView:shouldStartLoadWithRequest:navigationType:
But this delegate is not getting called when tapped on the video to launch it. It's otherwise getting called while the first webview itself is launched from the url.
EDIT:
- (void)loadView {
[super loadView];
activityIndicatorView = [[ActivityIndicator alloc] init];
web = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
web.delegate = self;
NSString *videoUrl = @"http://www.youtube.com/watch?v=";
NSString *fullVdoUrl = [videoUrl stringByAppendingFormat:_videoUrl];
NSString *urlAddress = [NSString stringWithFormat:fullVdoUrl];
NSURL *url = [NSURL URLWithString:urlAddress]; //Create a URL object.
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; //URL Requst Object
[web loadRequest:requestObj]; //Load the request
[self.view addSubview:web];
[web release];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[activityIndicatorView.view removeFromSuperview];
web.alpha = 1.0;
}
- (void)webViewDidStartLoad:(UIWebView *)webView {
[self.view addSubview:activityIndicatorView.view];
}
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
web.alpha = 0.0;
return YES;
}
Can anybody please help? It's really urgent.
Thanx in advance.