YouTube video completion notice on iPhone app

I implemented the YouTube video without any difficulty by following method # 2 on the YouTube API Blog:

http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-apps.html

Is there a way to find out when the video has finished playing (or when the user clicks the Finish button on the video controller)?

For example, say you wanted to play each video in a playlist without requiring the user to interact with the application. Is there any hook to start the next video?

+4
source share
2 answers

I'm afraid you are out of luck. I searched the same about six months before and came to the conclusion that this is not possible with the current SDK. I also sent a similar question to the stack overflow.

fooobar.com/questions/1339296 / ... i

In general, if you need such functionality, you should use MPMoviePlayerCOntroller , not a web view. Even then, I don’t think youtube URLs are supported by this class.

+1
source

Going through paid mail is what I implemented to determine if the YouTube / Safari window is on. My application is really simple, and it has only the main window, and the YouTube / Safari view is loading.

viewDidLoad:

activeWindow = [[UIApplication sharedApplication] keyWindow]; windowTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(checkForMedia) userInfo:nil repeats:YES]; - (void) checkForMedia{ newWindow = [[UIApplication sharedApplication] keyWindow]; if(newWindow == activeWindow){ NSLog(@"media is not playing"); }else{ NSLog(@"media is playing"); } } 
0
source

Source: https://habr.com/ru/post/1339294/


All Articles