In System Information (or the command line equivalent: system_profiler) we can check if a display is built-in:
Displays:
Color LCD:
Display Type: LCD
Resolution: 1680 x 1050
Pixel Depth: 32-Bit Color (ARGB8888)
Main Display: Yes
Mirror: Off
Online: Yes
Built-In: Yes
What API should I use to check the same information? The app needs to disable playback when external display is connected. Note that HDCP isn't available on Mac therefore disabling it is the only way. (DRM stuff, which I hate).