Closed defagos closed 3 years ago
Here is what I found. This may contain errors but should provide the necessary steps to investigate the problem further:
AVDateRangeMetadataGroup
instead of time ranges would maybe solve the issue for DVR livestreams, but this is not the case.The strategy:
AVPlayerViewController
and metadata (~10 segments).AVKit
bug which we could report.If we want to reduce the number of forced reloads, we still can test metadata only (not ranges) with the following condition:
if (! [[navigationMarkers valueForKeyPath:@"items"] isEqualToArray:[previousNavigationMarkers valueForKeyPath:@"items"]]) {
...
}
Intuition confirmed with a demo project: When playing a DVR livestream, the info panel scroll position is periodically reset. We should probably file a bug.
I don't recommend we reduce the number of reloads. Hopefully tvOS 14 will improve the available APIs and fix the above issue.
Still an issue with tvOS 14.2.
The tvOS player UX has been entirely redesigned in tvOS 15 and most periodic updates now work fine. The reload trick has been removed.
At the moment, there is no official
AVPlayerViewController
API to update navigation markers and metadata displayed in the info panel. Updating them on the player item after the view controller has been loaded once does not work. Not only titles or images displayed will not change, but changes in the navigation marker timestamps will not be reflected.I use a workaround to force a panel refresh, but with the issue that the scrolling position is then reset. The current implementation checks if navigation markers did change (metadata and timestamps), event slightly, and if this is the case forces a reload.
This is probably too much with the current control we have over the info panel, as sometimes times might slightly change (when calculating them based on stream dates). If we assume that markers timestamps are quite constant, we might probably loosen up a bit the comparison so that this better work, e.g. by only comparing the relevant metadata and number of items. Only in such cases should we trigger a reload.