[MPMoviePlayerController alloc] 로 변수 선언
ex)
//------ 플레이어 생성할 함수 --------
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:url];
...
...
...
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayerPlaybackStateDidChange:)
name:MPMoviePlayerPlaybackStateDidChangeNotification
object:nil];
//------------------------------------
//---------- 호출될 함수 ------------
-(void) moviePlayerPlaybackStateDidChange:(NSNotification*)notification {
NSLog(@"moviePlayerPlaybackStateDidChange");
MPMoviePlayerController *moviePlayer = notification.object;
MPMoviePlaybackState playbackState = moviePlayer.playbackState;
switch (playbackState) {
case MPMoviePlaybackStateStopped:
NSLog(@"MPMoviePlaybackStateStopped");
break;
case MPMoviePlaybackStatePlaying:
NSLog(@"MPMoviePlaybackStatePlaying");
break;
case MPMoviePlaybackStatePaused:
NSLog(@"MPMoviePlaybackStatePaused");
break;
case MPMoviePlaybackStateInterrupted:
NSLog(@"MPMoviePlaybackStateInterrupted");
break;
case MPMoviePlaybackStateSeekingForward:
NSLog(@"MPMoviePlaybackStateSeekingForward");
break;
case MPMoviePlaybackStateSeekingBackward:
NSLog(@"MPMoviePlaybackStateSeekingBackward");
break;
default:
break;
}
}
댓글 없음:
댓글 쓰기