-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash during continuous playback transitions #259
Comments
This is likely a tvOS 15 regression, probably in the way tvOS deals with interstitial updates or when an I guess we should create a small
|
I can simply reproduce the issue in SRG Media Player demo by switching the media after some while in the SRG Media Player View Controller demo: dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(7. * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[playerViewController.controller playURL:media.URL];
}); No matter whether the player item interstitial property is set or not, the crash occurs. So a good sample project could be:
By experimenting a bit with the code executed upon KVObservation of player changes we might be able to figure out what causes the crash. |
The following NSURL *URL = ...;
AVPlayerViewController *playerViewController = [[AVPlayerViewController alloc] init];
playerViewController.delegate = self;
AVPlayer *player = [AVPlayer playerWithURL:URL];
playerViewController.player = player;
[self presentViewController:playerViewController animated:YES completion:^{
[player play];
}];
@weakify(playerViewController)
[playerViewController addObserver:self keyPath:@keypath(playerViewController.player) options:0 block:^(MAKVONotification *notification) {
@strongify(playerViewController)
NSLog(@"--> %@", playerViewController);
}];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(7. * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
playerViewController.player = [AVPlayer playerWithURL:URL];
[playerViewController.player play];
}); |
Crash is likely due to |
Code to reproduce the crash with NSURL *URL = ...;
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"System player", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
AVPlayerViewController *playerViewController = [[AVPlayerViewController alloc] init];
playerViewController.delegate = self;
AVPlayer *player = [AVPlayer playerWithURL:URL];
playerViewController.player = player;
[self presentViewController:playerViewController animated:YES completion:^{
[player play];
}];
@weakify(playerViewController)
[playerViewController addObserver:self keyPath:@keypath(playerViewController.player) options:0 block:^(MAKVONotification *notification) {
@strongify(playerViewController)
playerViewController.player = player;
}];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5. * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
playerViewController.player = [AVPlayer playerWithURL:];
[playerViewController.player play];
});
}]]; |
It might be related to the deallocation of the previous player instance, rather than to the assignment to the player view controller. This should be further investigated. |
The crash randomly occurs when setting the This can be reproduced in a sample project which I will submit to Apple. I also suspect we can find a workaround in the meantime. If we try to set the property to an It is also very likely that this issue would be less of a problem if we were using a single |
@defagos Nice bug understanding. Enabling auto play in Letterbox demo and displaying the continuous playback screen, no more crashes on tvOS. |
The app crashes when a new media is being played after continuous playback display.
Issue type
Crash
Description of the problem
Stack trace:
This is an issue with interstitials and KVO, probably a regression of tvOS 15.
Environment information
Reproducibility
Always reproducible
Steps to reproduce
The text was updated successfully, but these errors were encountered: