Note that there are some explanatory texts on larger screens.

plurals
  1. POCan MPMoviePlayerViewController return error if video file is corrupt?
    text
    copied!<p>I am downloading the video and saved it in some directory so user can play that file afterwards.</p> <p>It works well in all the cases like when download stopped and resume again due to some network fluctation. But sometimes file downloaded completely but not playing in MPMoviePlayerViewController. </p> <p>I am using ASIHTTPRequest to download video file in background.</p> <p>Observation: May be while downloading, network fluctuates some times and file may be corrupted.</p> <p>Question: How can I came to know that downloaded file is corrupted? (via MPMoviePlayerViewControll)</p> <p>Any suggestions? Below is the code to play:</p> <p>@ACB... I used your code, but it always going in else condition: </p> <pre><code> playerViewController = [[MPMoviePlayerViewController alloc]initWithContentURL:url]; player = [playerViewController moviePlayer]; player.movieSourceType = MPMovieSourceTypeFile; [player prepareToPlay]; if(player.loadState == MPMovieLoadStatePlayable) { playerViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentMoviePlayerViewControllerAnimated:playerViewController]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerInterruptByUser:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:playerViewController.moviePlayer]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:playerViewController.moviePlayer]; //[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerFinished:) name:UIApplicationDidEnterBackgroundNotification object:playerViewController.moviePlayer]; [player play]; } else { corruptVideoAlert = [[UIAlertView alloc]initWithTitle:NSLocalizedString(@"Corrupt Video", nil) message:NSLocalizedString(@"This video is corrupted due to some network error. We suggest you to download again. Do you want to download it again?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"NO", nil) otherButtonTitles:NSLocalizedString(@"YES", nil),nil]; [corruptVideoAlert show]; [corruptVideoAlert release]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload