I am trying to identify if a file can be played in MPMoviePlayer or not,
for this I have added below code in viewDidLoad:

    [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:_fileDisplayMoviePlayer];

and defined it like this:

    - (void)moviePlayBackDidFinish:(NSNotification*)notif
    {
    NSNumber* reason = [[notif userInfo]
objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
    switch ([reason intValue]) {
        case MPMovieFinishReasonPlaybackEnded:
            NSLog(@"Playback Ended");
            break;
        case MPMovieFinishReasonPlaybackError:
            NSLog(@"Playback Error");
            [self performSelector:@selector(CorruptVideoAlertView)
withObject:nil afterDelay:1.0];
            break;
        case MPMovieFinishReasonUserExited:
            NSLog(@"User Exited");
            break;
        default:
            break;
    }

To verify it, I used below test case scenario:

I changed the extension of .rtf file to .mp3, and tried to play it
in player.

Though notification was invoked, it returned reason as -
MPMovieFinishReasonPlaybackEnded. It should have returned -
MPMovieFinishReasonPlaybackError.

Please suggest how can I test the above scenario, and get the expected
result.
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to