tvOS 11 GM Play Pause AVPlayerViewController not working

Hi,


I'm using AVPlayerViewController as a subview in a fullscreen UIViewController presented modally with UIModalTransitionStyleCrossDissolve.


As of tvOS 11, no controller input would work except for the menu button. Swipes were not recognized, button presses not recognziend, etc.


Adding a preferredFocusView fixes MOST of the control issues except Play/Pause is still not recognized.


- (UIView*)preferredFocusedView {

if (self.moviePlayerController != nil) {

return ((AVPlayerViewController*)self.moviePlayerController).view;

} else {

return self.view;

}

}


Additionally, after closing the video player, Play/Pause is no longer recognized anywhere in the application. Prior to presenting the AVPlayerViewController, the app receives Play/Pause button events just fine.


I've tried capturing the Play/Pause events via UITapGestureRecognizer and subclassing UIApplication to override the sendEvent method. Neither fire for Play/Pause once the AVPlayerViewController is loaded and app must be restarted.


- (void)sendEvent:(UIEvent*)event {

[super sendEvent:event];

if (self.remoteControlEventsDelegate) {

BOOL playPausePressed = NO;

if (event.subtype == UIEventSubtypeRemoteControlPlay || event.subtype == UIEventSubtypeRemoteControlPause || event.subtype == UIEventSubtypeRemoteControlTogglePlayPause) {

playPausePressed = YES;

}

else if ([event isKindOfClass:[UIPressesEvent class]]) {

for (UIPress *press in [(UIPressesEvent *)event allPresses]) {

BOOL buttonReleased = press.phase == UIPressPhaseEnded || press.phase == UIPressPhaseCancelled;

switch (press.type) {

case UIPressTypePlayPause:

playPausePressed = buttonReleased;

break;

default:

break;

}

}

}

if (playPausePressed && [self.remoteControlEventsDelegate respondsToSelector:@selector(playPausePressed)]) {

[self.remoteControlEventsDelegate playPausePressed];

}

}

}


This is a critical bug for video player apps.


How can we resolve this issue?


Thanks

James

Replies

Hi, I have the same issue with a different scenario.


In my case, I have ViewController (A) with a video playing in an AVPlayerLayer, then after open an AVPlayerViewController above A, I don't get any feedback of the button play/pause. I sent a bug report, but didn't get any response.


You were able to find another solution? Did you send a bug report?


Thanks

Having the same issue with the play/pause button losing functionality. Usually if I connect the remote to power for a bit, it will start working again.