Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification Changes on error condition #100

Closed
wants to merge 2 commits into from

Conversation

gardano
Copy link

@gardano gardano commented Jan 8, 2015

No description provided.

@gardano gardano closed this Jan 8, 2015
@gardano
Copy link
Author

gardano commented Jan 8, 2015

I need to auto-advance when I receive an error (restricted video), but I want to have finer-grained control when the video stops in other conditions. What do you think? Any other alternative ways to achieve this?

Thanks,
Tom

@gardano gardano reopened this Jan 8, 2015
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 509a0ff on inaka:tom.jan8.notificationsChanges into c973a56 on 0xced:master.

@0xced
Copy link
Owner

0xced commented Jan 11, 2015

I realize this is not very well documented (only in XCDYouTubeClient, not in XCDYouTubeVideoPlayerViewController), but the error’s domain is guaranteed to be XCDYouTubeVideoErrorDomain.

So you can simply achieve what you want like this:

- (void) moviePlayerPlaybackDidFinish:(NSNotification *)notification
{
    NSError *error = notification.userInfo[XCDMoviePlayerPlaybackDidFinishErrorUserInfoKey];
    if ([error.domain isEqualToString:XCDYouTubeVideoErrorDomain] && error.code == XCDYouTubeErrorRestrictedPlayback)
    {
        // auto-advance code here
    }
}

@0xced 0xced closed this Jan 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants