2
누군가가이 기능이 작동하지 않는 이유를 지적 할 수 있습니까?MPMoviePlayerController가 작동하지 않음, 알림 없음
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];
콜백 트리거가 없습니다. 캔버스가있는 빈 공간 만 있으면됩니다.
[비디오 재생]으로 확인하십시오. 대신 [비디오 prepareToPlay]; –
감사하지만 같은 거래가 코드의 모든 라인을 통과하지만 아무 것도 트리거하지 않는다는 것을 보여줍니다. – BarryF
viewDidLoad에서 viewDidAppear로 이동하면 나에게이 문제가 해결되었습니다. – BarryF