thumbnailImageAtTime: now deprecated - What's the alternative?

后端 未结 7 1294
小鲜肉
小鲜肉 2020-12-04 20:27

Until iOS7 update I was using...

UIImage *image = [moviePlayer thumbnailImageAtTime:1.0 timeOption:MPMovieTimeOptionNea         


        
7条回答
  •  不知归路
    2020-12-04 20:29

    Jeely provides a good work around but it requires an additional library that isn't necessary when the MPMoviePlayer already provides functions for this task. I noticed a syntax error in the original poster's code. The thumbnail notification handler expects an object of type NSNotification, not a dictionary object. Here's a corrected example:

    -(void)MPMoviePlayerThumbnailImageRequestDidFinishNotification: (NSNotification*)note
    {
        NSDictionary * userInfo = [note userInfo];
        UIImage *image = (UIImage *)[userInfo objectForKey:MPMoviePlayerThumbnailImageKey];
        if(image!=NULL)
            [thumbView setImage:image];
    }
    

提交回复
热议问题