I want to launch Media Player upon clicking on a video link within UIWebView. The content of the UIWebView is an HTML5 page on my server, so whether the solution is to change the code in XCode or HTML5 I will be able to handle it.
All the videos in question are of 'mp4' extension - Just in case this addition helps.
Please note this is for an iPad-only App.
This code could be modified to launch a video based on a button click from within the app.
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"filename" ofType:@"mp4"];
//LOCAL FILE
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
//REMOTE FILE
NSURL *fileURL = [NSURL URLWithString:@"http://someurlsomewhere.com/movie.mp4"];
player = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
player.frame = CGRectMake(0, 0, 1024, 768);
[self.view addSubview:player.view];
player.fullscreen = NO;
[player play];
Here is a link that covers detecting taps/clicks from a webview which may be what you need in order to trigger the video. how to intercept Button click inside UIWebview on IOS?