2

誰かがこれがうまくいかない理由を指摘できますか?

NSURL  *url = [NSURL fileURLWithPath:ImageName];

MPMoviePlayerController *video = [[MPMoviePlayerController alloc]  initWithContentURL:url];
            NSLog(@"%@", ImageName);
            NSLog(@" %@", url);
            [canvas addSubview:video.view];
            video.view.frame = canvas.bounds; 

//  [video setControlStyle:MPMovieControlStyleEmbedded];
    [[NSNotificationCenter defaultCenter] addObserver:self  selector:@selector(myMovieCallback:)  name:MPMoviePlayerPlaybackDidFinishNotification          object:video];
    [[NSNotificationCenter defaultCenter] addObserver:self  selector:@selector(myMovieCallback:)  name:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey     object:video];
    [[NSNotificationCenter defaultCenter] addObserver:self  selector:@selector(myMovieCallback:)  name:MPMoviePlayerPlaybackStateDidChangeNotification     object:video];
    [[NSNotificationCenter defaultCenter] addObserver:self  selector:@selector(myMovieCallback:)  name:MPMoviePlayerLoadStateDidChangeNotification         object:video];
    [[NSNotificationCenter defaultCenter] addObserver:self  selector:@selector(myMovieCallback:)  name:MPMoviePlayerNowPlayingMovieDidChangeNotification   object:video];
    [video prepareToPlay];

どのコールバックもトリガーされません。キャンバスがある場所に空白を入れてください。

4

1 に答える 1

1

MPMoviePlayerControllerインスタンス変数またはプロパティに参照を保持すると、うまくいきました。

于 2013-09-24T07:13:55.430 に答える