J'essaie de charger un film mp4 de 25 secondes à partir de mon fichier de ressources, mais lorsque je le joue, mon sélecteur MPMoviePlayerPlaybackDidFinishNotification est immédiatement appelé avec MPMovieFinishReasonPlaybackEnded. Lorsque j'identifie mon état de lecture, cela affiche ceci:MPMoviePlayerController se termine immédiatement
MPMoviePlaybackStatePlaying
MPMoviePlaybackStatePaused
MPMoviePlaybackStateStopped
MovieFinishReasonPlaybackEnded
MPMoviePlaybackStatePlaying
MPMoviePlaybackStatePaused
même si j'appelle une seule fois la méthode de lecture. J'espère que quelqu'un peut m'aider.
- Edité pour montrer mon code:
MPMoviePlayerController* player = [[[MPMoviePlayerController alloc] initWithContentURL:movieURL] autorelease];
if (player)
{
self.moviePlayerController = player;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayerPlaybackStateDidChange:)
name:MPMoviePlayerPlaybackStateDidChangeNotification
object:player];
player.contentURL = movieURL;
player.movieSourceType = MPMovieSourceTypeFile;
player.controlStyle = MPMovieControlStyleNone;
player.fullscreen = YES;
switch (orientation) {
case UIInterfaceOrientationLandscapeLeft:
player.view.transform = CGAffineTransformMakeRotation(90.0f * (M_PI/180.0f));
break;
case UIInterfaceOrientationLandscapeRight:
player.view.transform = CGAffineTransformMakeRotation(-90.0f * (M_PI/180.0f));
break;
default:
break;
}
player.view.frame = self.view.bounds;
[self.view addSubview:player.view];
}
[self.moviePlayerController play]
J'ai essayé Movie.m4v à partir du lien et cela ne fonctionne toujours pas. – Jebadiah
Ensuite, vous devrez probablement montrer votre code pour que quelqu'un puisse vous aider. – Darren
Il suffit de modifier ma question. Je vous remercie. – Jebadiah