MPMoviePlayerController "thumbnailImageAtTime:timeOption:" selector does not exist
This code
MPMoviePlayerViewController* mp = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
int i=0;
unsigned int mc = 0;
Method * mlist = class_copyMethodList(object_getClass([mp moviePlayer]), &mc);
NSLog(@"%d methods", mc);
for(i=0;i<mc;i++)
NSLog(@"Method no #%d: %s", i, sel_getName(method_getName(mlist[i])));
/* note ml开发者_如何学JAVAist needs to be freed */
if ([[mp moviePlayer] respondsToSelector:@selector(thumbnailImageAtTime:timeOption:)])
{
image = [[mp moviePlayer] thumbnailImageAtTime:(NSTimeInterval)2.0 timeOption: MPMovieTimeOptionNearestKeyFrame];
}
[mp release];
print this Log
45 methods
Method no #0: pause
Method no #1: stop
Method no #2: initialPlaybackTime
Method no #3: setInitialPlaybackTime:
Method no #4: scalingMode
Method no #5: setScalingMode:
Method no #6: contentURL
Method no #7: initWithContentURL:
Method no #8: movieSourceType
Method no #9: setMovieSourceType:
Method no #10: movieMediaTypes
Method no #11: prepareToPlay
Method no #12: isPreparedToPlay
Method no #13: isFullscreen
Method no #14: setUseApplicationAudioSession:
Method no #15: shouldAutoplay
Method no #16: setShouldAutoplay:
Method no #17: controlStyle
Method no #18: setControlStyle:
Method no #19: setContentURL:
Method no #20: setFullscreen:animated:
Method no #21: useApplicationAudioSession
Method no #22: playableDuration
Method no #23: setEndPlaybackTime:
Method no #24: endPlaybackTime
Method no #25: loadState
Method no #26: dealloc
Method no #27: view
Method no #28: init
Method no #29: forwardInvocation:
Method no #30: backgroundView
Method no #31: methodSignatureForSelector:
Method no #32: duration
Method no #33: play
Method no #34: setRepeatMode:
Method no #35: playbackState
Method no #36: setFullscreen:
Method no #37: naturalSize
Method no #38: skipToBeginning
Method no #39: repeatMode
Method no #40: beginSeekingBackward
Method no #41: beginSeekingForward
Method no #42: endSeeking
Method no #43: skipToNextItem
Method no #44: skipToPreviousItem
There is no any of thumbnail selectors.
Who know reason of this strange behavior?
Objective-C has multiple-level dispatch, so it's possible that the method you're interested in is implemented lazily or by forwarding. To see if it's lazily resolved, just move your loop to after you call the method.
While the above is all true, the method you're looking for is on MPMoviePlayerController, not MPMoviePlayerViewController.
精彩评论