This appears to be an Apple bug in iPadOS 14.4 - I was able to reproduce the problem in a pure Obj-C app with no JUCE code.
If you disable the app’s status bar by overriding your ViewController’s prefersStatusBarHidden
property to YES
, then add a subview to the root view which contains an AVPlayer
, then the root view will disappear (but strangely only when the native transport controls of the player fade out).
ViewController.h:
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <AVKit/AVKit.h>
@interface ViewController : UIViewController
{
AVPlayerViewController* playerViewController;
}
@end
ViewController.m:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (BOOL) prefersStatusBarHidden
{
return YES;
}
- (void) viewDidLoad
{
[super viewDidLoad];
CGRect r = CGRectMake (0, 0, 500, 500);
UIView* v = [[UIView alloc] initWithFrame: r];
[v setBackgroundColor: [UIColor redColor]];
playerViewController = [AVPlayerViewController new];
NSURL* videoURL = [NSURL URLWithString: @"https://www.rmp-streaming.com/media/bbb-360p.mp4"];
AVPlayer* player = [AVPlayer playerWithURL: videoURL];
playerViewController.player = player;
[player play];
[v addSubview: [playerViewController view]];
[[playerViewController view] setFrame: CGRectMake (200, 200, 200, 200)];
[self setView: v];
}
@end
I’ve submitted a bug report to Apple, but in the meantime you can work around this by enabling the status bar in your app by setting UIStatusBarHidden
to NO
in the app’s .plist.