2010-04-28 4 views
2

Possible en double:
Using MPMoviePlayerViewController in SDK 3.2 for iPadtactile Cocoa SDK 3.2 - Comment lire la vidéo

Comment puis-je lire la vidéo sur SDK 3.2 (iPad)?

Lisez beaucoup de questions ici, mais ils parlaient surtout pour iPhone.
Par exemple, l'exemple MoviePlayer ici http://developer.apple.com/iphone/library/samplecode/MoviePlayer_iPhone/Introduction/Intro.html

Cela fonctionne sur 3.1.3 mais quand je l'exécute sur 3.2, cela ne fonctionne pas.

Donc, fondamentalement, je suis capable de lire une vidéo sur 3.1.3 en utilisant ce code, mais le même code ne fonctionnera pas sur 3.2

NSString * moviePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: @ "Movie.mp4"];

MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]]; 

moviePlayer.movieControlMode = MPMovieControlModeDefault; 

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; 

[moviePlayer play]; 

Merci,
T

Répondre

0

J'ai eu à travailler. Voici comment:

NSURL* videoURL = [NSURL URLWithString:url]; 
MPMoviePlayerController moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL]; 
[moviePlayer prepareToPlay]; 
[moviePlayer play]; 
[self.view addSubview:moviePlayer.view]; 

Merci,
T

Questions connexes