开发者

How do i catch the MPMoviePlayer progressbar track event on the iphone

开发者 https://www.devze.com 2023-02-12 07:14 出处:网络
In my application i am using MPMoviePlayerController for playing the video.I want to take the event when the user trying to skip the movie(track the progressbar).

In my application i am using MPMoviePlayerController for playing the video.I want to take the event when the user trying to skip the movie(track the progressbar).

before that just clarify my 开发者_如何学Pythondoubt,is there a possibility to getting the event when the user trying to skip the video(track the progressbar).

Thank You:)


there are many notifications defined for MPMoviePlayerController

// Posted when the scaling mode changes.

MP_EXTERN NSString *const MPMoviePlayerScalingModeDidChangeNotification;

// Posted when movie playback ends or a user exits playback.
MP_EXTERN NSString *const MPMoviePlayerPlaybackDidFinishNotification;

MP_EXTERN NSString *const MPMoviePlayerPlaybackDidFinishReasonUserInfoKey NS_AVAILABLE_IPHONE(3_2); // NSNumber (MPMovieFinishReason)

// Posted when the playback state changes, either programatically or by the user.
MP_EXTERN NSString *const MPMoviePlayerPlaybackStateDidChangeNotification NS_AVAILABLE_IPHONE(3_2);

// Posted when the network load state changes.
MP_EXTERN NSString *const MPMoviePlayerLoadStateDidChangeNotification NS_AVAILABLE_IPHONE(3_2);

// Posted when the currently playing movie changes.
MP_EXTERN NSString *const MPMoviePlayerNowPlayingMovieDidChangeNotification NS_AVAILABLE_IPHONE(3_2);

// Posted when the movie player enters or exits fullscreen mode.
MP_EXTERN NSString *const MPMoviePlayerWillEnterFullscreenNotification NS_AVAILABLE_IPHONE(3_2);
MP_EXTERN NSString *const MPMoviePlayerDidEnterFullscreenNotification NS_AVAILABLE_IPHONE(3_2);
MP_EXTERN NSString *const MPMoviePlayerWillExitFullscreenNotification NS_AVAILABLE_IPHONE(3_2);
MP_EXTERN NSString *const MPMoviePlayerDidExitFullscreenNotification NS_AVAILABLE_IPHONE(3_2);
MP_EXTERN NSString *const MPMoviePlayerFullscreenAnimationDurationUserInfoKey NS_AVAILABLE_IPHONE(3_2); // NSNumber of double (NSTimeInterval)
MP_EXTERN NSString *const MPMoviePlayerFullscreenAnimationCurveUserInfoKey NS_AVAILABLE_IPHONE(3_2);     // NSNumber of NSUInteger (UIViewAnimationCurve)

which one is you need?


I have tried and got the answer for this question(notification for progressbar tracking),

CODE:

-(void) moviePlayerPlaybackStateDidChange:(NSNotification*)notification {

NSLog(@"moviePlayerPlaybackStateDidChange");
MPMoviePlayerController *moviePlayer = notification.object;
MPMoviePlaybackState playbackState = moviePlayer.playbackState;
if(playbackState == MPMoviePlaybackStateStopped)
{
    NSLog(@"MPMoviePlaybackStateStopped");
} 
if(playbackState == MPMoviePlaybackStatePlaying) 
{
    NSLog(@"MPMoviePlaybackStatePlaying");
} 
if(playbackState == MPMoviePlaybackStatePaused)
{
    NSLog(@"MPMoviePlaybackStatePaused");
} 
if(playbackState == MPMoviePlaybackStateInterrupted) 
{
    NSLog(@"MPMoviePlaybackStateInterrupted");
} 
if(playbackState == MPMoviePlaybackStateSeekingForward)
{
    NSLog(@"MPMoviePlaybackStateSeekingForward");
} 
if(playbackState == MPMoviePlaybackStateSeekingBackward)
{
    NSLog(@"MPMoviePlaybackStateSeekingBackward********");
}

}

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号