2
Mon iPhone est un iOS4 (mise à jour 3.1.3). J'ai essayé ce code.Comment utiliser MPMoviePlayerViewController sur iOS4 (mise à jour 3.1.3)
#import <UIKit/UIKit.h>
@interface testViewController : UIViewController {
}
@end
//-------------------------------------------------
#import <MediaPlayer/MediaPlayer.h>
#import "testViewController.h"
@implementation testViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSBundle *Bundle = [NSBundle mainBundle];
NSString *moviePath = [Bundle pathForResource:@"test" ofType:@"MOV"];
NSURL *videoURL = [[NSURL fileURLWithPath:moviePath] retain];
MPMoviePlayerViewController *theMovie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];
[self presentMoviePlayerViewControllerAnimated:theMovie];
theMovie.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[theMovie.moviePlayer play];
}
- (void)dealloc {
[super dealloc];
}
@end
Lorsque j'exécute l'aplication, la vidéo ne fonctionne pas et ne fait que lire le son. Quel est le problème avec ce code?
Merci.
J'ai eu le même problème dans mon application. [Voici un lien vers ma solution] (http://stackoverflow.com/questions/3092117/a-problem-with-media-player-base-on-ios4-and-deploy-ios3/3116123#3116123). – stitz