txt file renamed to mp3, MPMoviePlayerPlaybackDidFinishReasonUserInfoKey returning 0
txt file renamed to mp3, MPMoviePlayerPlaybackDidFinishReasonUserInfoKey returning 0
- Subject: txt file renamed to mp3, MPMoviePlayerPlaybackDidFinishReasonUserInfoKey returning 0
- From: Devarshi Kulshreshtha <email@hidden>
- Date: Thu, 03 Oct 2013 18:04:38 -0500
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@hidden)
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:
This email sent to email@hidden