MPMoviePlayerController获取的Thumbnail image总是null

原创
2017/04/21 09:52
阅读数 44
先用requestThumbnailImagesAtTimes方法获取thumbnailImage:

MPMoviePlayerController *aplayer = [[MPMoviePlayerController alloc] initWithContentURL:_mediaUrl];

    self.moviePlayer = aplayer;

    _moviePlayer.controlStyle = MPMovieControlStyleEmbedded;

    _moviePlayer.view.frame = _moviePic.bounds;

    _moviePlayer.shouldAutoplay = NO;

    [_moviePlayer prepareToPlay];

    [_moviePlayer requestThumbnailImagesAtTimes:[NSArray arrayWithObject:[NSNumber numberWithDouble:1.0]] timeOption:MPMovieTimeOptionExact];

    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(movieThumbnailLoadComplete:) name:MPMoviePlayerThumbnailImageRequestDidFinishNotification object:nil];

    [aplayer release];

 

接收消息

-(void)movieThumbnailLoadComplete:(NSNotification*)notification

{

    NSLog(@"%@",notification.userInfo);

    NSDictionary *userInfo = [notification userInfo];  

    UIImage *image =[userInfo objectForKey: @"MPMoviePlayerThumbnailImageKey"];

}

 

打印出来的thumbnail image总是nan,到底是为什么呢?是不是只能获取本地视频的缩略图呢?

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部