我在做,显示在视频的特定间隔重叠的视频。 我设法让视频播放。 现在我的目标是看/观察currentPlaybackTime值和暂停视频当它击中2秒。
经过一番研究,发现currentPlaybackTime不支持KOV。 所以,我需要实现这个解决方案 ,但我不知道在哪里把代码-我很新的目标C.我一直试图把它的视图控制器(我唯一的看法),但方式书面提示,它是放在别的地方...
我应该为它创建一个新的控制器? 还是我覆盖从MediaPlayer的框架方法?
这里是我的代码:
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
@interface ViewController : UIViewController
@property (strong, nonatomic) MPMoviePlayerController *movieController;
@property(nonatomic) NSTimeInterval currentPlaybackTime;
@end
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (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.
}
- (void)viewDidAppear:(BOOL)animated {
self.movieController = [[MPMoviePlayerController alloc] init];
NSString *moviePath = [[NSBundle mainBundle] pathForResource:@"Movie" ofType:@"m4v"];
NSURL *movieURL = [NSURL fileURLWithPath:moviePath];
self.movieController = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
[self.movieController.view setFrame:CGRectMake (0, 0, 480, 326)];
[self.view addSubview:self.movieController.view];
[self.movieController play];
[self.movieController currentPlaybackTime];
}
@end