我有一个 html 按钮UIWebView
,点击它会推送一个UIViewController
带有编程的 segue 动作的按钮。如何在加载 UIViewController 时播放电影MPMoviePlayer
。此代码播放 Movie inMPMoviePlayerViewController
而不是 segue push UIViewController
。我想在 segue 推送的 UIViewController 中播放电影。
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if ([request.URL.scheme isEqualToString:@"inapp"]) {
if ([request.URL.host isEqualToString:@"capture"]) {
[self performSegueWithIdentifier: @"SegueAction" sender: self];
NSURL * urlA1 = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"A1"ofType:@"mp4"]];
MPMoviePlayerViewController *playercontrollerA1 = [[MPMoviePlayerViewController alloc] initWithContentURL:urlA1];
playercontrollerA1.moviePlayer.repeatMode = MPMovieRepeatModeOne;
[self presentMoviePlayerViewControllerAnimated:playercontrollerA1];
playercontrollerA1.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
// do capture action
}
return NO;
}
return YES;
}