Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/111.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 拇指指甲成像时间不准确_Ios_Objective C_Mpmovieplayercontroller - Fatal编程技术网

Ios 拇指指甲成像时间不准确

Ios 拇指指甲成像时间不准确,ios,objective-c,mpmovieplayercontroller,Ios,Objective C,Mpmovieplayercontroller,我正在尝试创建一个应用程序,在该应用程序中,我可以在MPMoviePlayerController中播放视频。如果视频被暂停,它会截取一个带有。问题是MPMoviePlayerController在暂停后显示的图像与我用thumbnailImageAtTime获得的屏幕截图不一样 我的代码如下所示: [self.moviePlayer pause] [self.moviePlayer thumbnailImageAtTime:self.moviePlayer.currentPlaybackTim

我正在尝试创建一个应用程序,在该应用程序中,我可以在MPMoviePlayerController中播放视频。如果视频被暂停,它会截取一个带有。问题是MPMoviePlayerController在暂停后显示的图像与我用thumbnailImageAtTime获得的屏幕截图不一样

我的代码如下所示:

[self.moviePlayer pause]
[self.moviePlayer thumbnailImageAtTime:self.moviePlayer.currentPlaybackTime timeOption:MPMovieTimeOptionExact];


非常感谢您的帮助:)

我使用的是
MPMovieTimeOptionNearestKeyFrame

- (UIImage *)imageFromMovie:(NSURL *)movieURL atTime:(NSTimeInterval)time {
    // set up the movie player
    MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] 
                                   initWithContentURL:movieURL];
    mp.shouldAutoplay = NO;
    mp.initialPlaybackTime = time;
    mp.currentPlaybackTime = time;
    // get the thumbnail
    UIImage *thumbnail = [mp thumbnailImageAtTime:time 
                                       timeOption:MPMovieTimeOptionNearestKeyFrame];
    // clean up the movie player
    [mp stop];
    [mp release];
    return(thumbnail);
}

试试这个

谢谢你的回答!但是,我也尝试了
MPMovieTimeOptionNearestKeyFrame
选项。两帧仍然不匹配,看起来MPMoviePlayerController并不总是使用关键帧暂停视频