Fabio
Fabio

Reputation: 1973

How to play video .mp4 ios7?

I cant play the video because i have this notification error:

    - (void)playbackFinished:(NSNotification*)notification {
        NSNumber* reason = [[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
        switch ([reason intValue]) {

            case MPMovieFinishReasonPlaybackError:{
                **NSLog(@"playbackFinished. Reason: Playback Error");**
                [UIView animateWithDuration:1.0f
                                      delay:0
                                    options:UIViewAnimationOptionCurveEaseIn
                                 animations:^{

                                     [m_player.view setAlpha:0];

                                 }
                                 completion:^(BOOL finished){

                                     [m_player.view removeFromSuperview];
                                     m_player = nil;
                                 }];
            }
                break;

            default:
                break;
        }


 }

Any help is appreciated thanks !!!

Upvotes: 2

Views: 2299

Answers (1)

Michael Dautermann
Michael Dautermann

Reputation: 89509

You need to find out why you're getting a playback error so then you can figure out what needs to be done in order to solve the issue.

Looking at the answers to this closely related question, you'll see this code snippet:

    NSError *mediaPlayerError = [[notification userInfo] objectForKey:@"error"];
    if (mediaPlayerError) 
    {
        NSLog(@"playback failed with error description: %@", [mediaPlayerError localizedDescription]);
    }
    else
    {
        NSLog(@"playback failed without any given reason");
    }

Add these lines to your MPMovieFinishReasonPlaybackError case and you may figure out what's really up with your app. Good luck!

Upvotes: 1

Related Questions