Замена AVPlayer на MPMoviePlayerController

Я пытаюсь заменить AVPlayer на MPMoviePlayerController, так как хочу добавить анимацию с прозрачным фоном в представление. Проблема в том, что анимация не отображается с помощью MPMoviePlayerController.

Пожалуйста, найдите мои строки ниже. Первая часть с AVPlayer и она работает. Второй — с MPMoviePlayerController, а не с ним.

Код делает то, что воспроизводит анимацию, и когда это делается, он запускает действие.

Код с AVPlayer (работает):

NSString *filepath = [[NSBundle mainBundle] pathForResource:theAnimationFileName ofType:theString;

//NSURL *fileURL = [NSURL fileURLWithPath:filepath];
// First create an AVPlayerItem

AVPlayerItem* playerItem = [AVPlayerItem playerItemWithURL:fileURL];

// Subscribe to the AVPlayerItem's DidPlayToEndTime notification.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(itemDidFinishPlaying) name:AVPlayerItemDidPlayToEndTimeNotification object:playerItem];

// Pass the AVPlayerItem to a new player
controlledPlayer = [[AVPlayer alloc] initWithPlayerItem:playerItem];

AVPlayerLayer *animatedLayer = [AVPlayerLayer playerLayerWithPlayer:controlledPlayer];


[animatedLayer setFrame:CGRectMake(0, 0, 1024, 1024)];
[thisReplacementView.layer addSublayer: animatedLayer];


// Begin playback
[controlledPlayer play];

Код с MPMoviePlayerController (ничего не отображает):

NSString *moviePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:theString];

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

moviePlayer.controlStyle = MPMovieControlModeDefault;

moviePlayer.view.frame = CGRectMake(0, 0, 1024, 1024);

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


[thisReplacementView addSubview:moviePlayer.view];

[moviePlayer play];

person Armand    schedule 18.09.2013    source источник