ボタンをクリックするとFLVを再生するiPad用のシンプルなアプリを作成しようとしています。http://developer.apple.com/iphone/library/codinghowtos/AudioAndVideo/index.html#VIDEO-USE_THE_MEDIA_PLAYER_FRAMEWORK_FOR_VIDEO_PLAYBACKのコードを参照として使用しています。これが私のクリックイベントのコードです
-(IBAction) btnPlayVideoClick:(id) sender {
NSString* videoPath = [[NSBundle mainBundle] pathForResource:@"myVideo" ofType:@"flv"];
MPMoviePlayerController* myMovie = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:videoPath]];
myMovie.scalingMode = MPMovieScalingModeAspectFill;
// Register for the playback finished notification.
[[NSNotificationCenter defaultCenter] addObserver:self
selector: @selector(myMovieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:myMovie];
[myMovie play];
}
-(void)myMovieFinishedCallback:(NSNotification*)aNotification
{
MPMoviePlayerController* theMovie=[aNotification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:theMovie];
// Release the movie instance created in playMovieAtURL
[theMovie release];
}
アプリを正常にコンパイルして実行できますが、ボタンをクリックすると、エラー メッセージやアクティビティがまったく表示されずにアプリが終了します。私が間違っていることがありますか、それともシミュレーターを使用して FLV を再生できない理由がありますか? 開発ライセンスを取得するための承認を待っているため、まだ実際のデバイスでテストできません。
ありがとう、
マイク