我试图为视图控制器添加两个视频,这样一个视频就会正常,另一个视频就会变慢。
我在同一个视图控制器上有两个按钮。一个用于普通视频,另一个用于减速版本。
我已经成功添加了第一个按钮的集成视频,当我点击模拟器中的第一个按钮但是我想知道如何将第二个视频添加到同一个视图控制器时可以正常播放?
这是.h文件的代码
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
@interface ViewController5 : UIViewController{
}
-(IBAction)play;
@end
以下是.m文件的代码
#import "ViewController.h"
@interface ViewController5 ()
@end
@implementation ViewController5
-(IBAction)play {
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"Inside" ofType:@"mov"]];
MPMoviePlayerViewController *playercontroller = [[MPMoviePlayerViewController alloc]
initWithContentURL:url];
[self presentMoviePlayerViewControllerAnimated:playercontroller];
playercontroller.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[playercontroller.moviePlayer play];
playercontroller = nil;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end