我正在尝试从MPMoviePlayerController获取accesslog(在iOS 4.3中)。但每次都是零。我正在使用网址播放视频。请建议我做错了或与参考http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMovieAccessLog_Class/Reference/Reference.html
不同-(void) playMovie:(id) object
{
NSURL *aURL=[NSURL URLWithString:@"http://www.example.com/videos/video1.mp4"];
NSLog(@"URL %@",aURL);
theMovie=[[MPMoviePlayerController alloc] init ];
[theMovie setContentURL:aURL];
theMovie.scalingMode= MPMovieScalingModeAspectFill;
[theMovie.view setFrame:self.view.bounds];
[self.view addSubview:theMovie.view];
timer =[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(getData:) userInfo:nil repeats:YES];
[theMovie play];
}
-(void) getData:(NSTimer*) object
{
NSLog(@"------------Loggging start-------------");
MPMovieAccessLog *accessL=[theMovie accessLog];
NSArray *events = accessL.events;
for (int i=0; i<[events count]; i++) {
NSLog(@"- %@",[events objectAtIndex:i]);
}
NSLog(@"------------Loggging end-------------");
}
答案 0 :(得分:0)