I've been working with the eligibleforhdrplayback property to determine if HDR playback is supported. However, I've noticed an inconsistency. When the Video Format switches from HDR to SDR in the Settings menu on Apple TV, the property still returns true, indicating HDR is playable even when it's not (This seems to contradict what was mentioned around the [20:40] mark of this WWDC video).
I've tried using the eligibleForHDRPlaybackDidChangeNotification and even restarted the app, but I still encounter the same issue.
Are there any alternative approaches to accurately determine if the app can play HDR or else can only play SDR content on an Apple TV?
edit:
The issue is that when I play a stream that contains HDR and the setting for HDR is off on a capable device then AVPlayer will throw an error.
AVFoundationErrorDomain -11868 cannot open
Consider using APIs like AVDisplayCriteria and also AVDisplayManager, where for example isDisplayCriteriaMatchingEnabled tells you the user's "Match Content" settings and from such details you could get some hints about whether the device is on HDR or SDR mode.
If all attempts are failing, then finally see if this quick hack helps you out:
The idea of above solution is that if you do a (sandboxed) Try to "play a stream that contains HDR and the setting for HDR is
offon a capable device then AVPlayer will throw an error", so now this caught error becomes the answer itself to knowing whether the device mode is HDR or SDR.From research of AVDisplayManager, my understanding is that you need a code flow similar to the one shown below.
Below is a flow of instructions you can experiment with (eg: it gives you hints of possible commands to try within your own code. Don't need all. Pick and test pieces that seem useful):
(older version)
If you read carefully in the documentation, they say..
My understanding of device is: That boolean tells you if the hardware can support HDR playback.
It does not care about any user settings in the menu, only what the device/chip itself can achieve.
It will be
truebecause a user setting of SDR does not mean the device itself cannot support HDR.