oldValue, newValue in NSKeyValueObservation are nil for some properties and not others

We are noticing that when we perform KVO Observations on AVPlayer properties and we pass [.old, .new] some properties still cause NSKeyValueObservation result to have nil values for oldValue, newValue.

Example:

(note that according to https://developer.apple.com/documentation/avfoundation/avplayeritem/1389493-status "You can observe this change using key-value observing.")

Code Block
playerItemStatusObservation = item.observe(\AVPlayerItem.status, options: [.old, .new]) {[weak self] item, change in
// using `[.old, .new]` as options doesn't actually returns non-nil values in the `change` parameter!
}

Oddly observing isPlaybackLikelyToKeepUp does provide non-nil oldValue, newValue

Code Block
playerItemLikelyToKeepUpObservation = item.observe(\AVPlayerItem.isPlaybackLikelyToKeepUp, options: [.old, .new]) {[weak self] item, change in
// using `[.old, .new]` as options actually returns non-nil values in `change`
}


Does anyone know the reason for this?

Thank you


Replies

It's hard to tell whether this is a problem with AVPlayer or the Swift interface for KVO. Will you file a bug using the feedback assistant? A sample project we can run to show the problem would be a great help. Thanks!