Skip to content

Instantly share code, notes, and snippets.

@fra3il

fra3il/0.m Secret

Last active February 2, 2016 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fra3il/525f4c49eb1e3e09e6ae to your computer and use it in GitHub Desktop.
Save fra3il/525f4c49eb1e3e09e6ae to your computer and use it in GitHub Desktop.
[WP/171] YouTube 동영상의 재생, 종료 시점을 확인하는 방법
- (void)viewDidLoad {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeStarted:) name:@"UIMoviePlayerControllerDidEnterFullscreenNotification" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeFinished:) name:@"UIMoviePlayerControllerDidExitFullscreenNotification" object:nil];
}
- (void)youTubeStarted:(NSNotification *)notification {
NSLog(@"youTubeStarted");
}
- (void)youTubeFinished:(NSNotification *)notification {
NSLog(@"youTubeFinished");
}
// iOS4.3 이상
UIMoviePlayerControllerDidEnterFullscreenNotification
UIMoviePlayerControllerDidExitFullscreenNotification
// iOS4.2 이하
UIMoviePlayerControllerDidEnterFullcreenNotification
UIMoviePlayerControllerDidExitFullcreenNotification
// YouTube
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_3
#define UIMoviePlayerControllerDidEnterFullscreenNotification @"UIMoviePlayerControllerDidEnterFullscreenNotification"
#define UIMoviePlayerControllerDidExitFullscreenNotification @"UIMoviePlayerControllerDidExitFullscreenNotification"
#else
#define UIMoviePlayerControllerDidEnterFullscreenNotification @"UIMoviePlayerControllerDidEnterFullcreenNotification"
#define UIMoviePlayerControllerDidExitFullscreenNotification @"UIMoviePlayerControllerDidExitFullcreenNotification"
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment