Create chapters for AVPlayerViewController using navigationMarkerGroups

I am trying to use the built in chapter handling of AVPlayerViewController to manage chapters within a video displayed by my app. I want to create the chapters programmatically inside the app (as they might end up being dynamically created).


I can't find any reference on how to set this up and specifically what keys to use when creating AVTimedMetadataGroup.


I am creating a AVNavigationMarkersGroup to populate the AVPlayerItem.navigationMarkerGroups property of my player item.


This AVNavigationMarkersGroup has a nil title (so it will be treated as a chapter list) and then an array of AVTimedMetaDataGroup.


Each AVTimedMetaDataGroup relates to a chapter with a CMTimeRange and an array of AVMutableMetadataItems. I can't figure out which keys to use when creating the mutable metadata items to populate this array. It seems that any key in any keyspace I use returns an error 'invoked with unrecognised keys'.


Whatever I try doesn't seem to change anything in the UI of the video player controls (I am expecting to see something that shows specified points on the timeline where the user can jump back and forth to).


Are there any examples of how to get this configured correctly?

Create chapters for AVPlayerViewController using navigationMarkerGroups
 
 
Q