Search code examples
uikittvoshdr

Detect HDR mode on tvOS


I'm making an Apple TV app and need to play one of two video files based on whether the Apple TV is in HDR mode or not, but I can't find a way to detect HDR mode.

Does anyone know how to detect this? All I can find is UIScreen, and it only seems to provide the resolution and aspect ratio.


Solution

  • According to this answer from Apple staff it is recommended to have one playlist supporting HDR and SDR. AVFoundation can automatically select the most appropriate variant for the device, if you use UIScreen you will get the wrong answer because it is possible to turn HDR off from the tvOS settings and this will not be presented by checking the UIScreen.