UIModalTransitionStyleCrossDissolve not working on AVPlayerViewController

Hi there,

I have an app with old code and now trying to replace the MPMoviePlayerViewController with the new AVPlayerViewController.


Unfortunate, it seems the AVPlayerViewController does not want to be presented via crossdissolve. It always appears with the default transition style. Am I missing something (maybe order of usage)?


NSURL *fileURL = [NSURL fileURLWithPath:movieFile];
AVPlayerViewController *mp = [[AVPlayerViewController alloc] init];
    
mp.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
       
[[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(movieFinishedCallback:)
                                                     name:AVPlayerItemDidPlayToEndTimeNotification
                                                   object:mp.player];
       
[[NSNotificationCenter defaultCenter] removeObserver:mp
                                                        name:AVPlayerItemDidPlayToEndTimeNotification
                                                      object:mp.player];
       
AVPlayer *player = [AVPlayer playerWithURL:fileURL];
mp.player = player;
       
[self presentViewController:mp animated:YES completion:nil];
      
[player play];

Accepted Reply

Hmpf, found the solution myself. After adding:


mp.modalPresentationStyle = UIModalPresentationCustom;


it works now.

Replies

Good

:-)


The AVPlayerViewController isn't presented anyhow via crossdissovle ... :-/

Hmpf, found the solution myself. After adding:


mp.modalPresentationStyle = UIModalPresentationCustom;


it works now.