--- video/out/cocoa_common.m.orig
+++ video/out/cocoa_common.m
@@ -91,6 +91,9 @@ struct vo_cocoa_state {
     uint64_t last_lmuvalue;
     int last_lux;
     IONotificationPortRef light_sensor_io_port;
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
+    CFRunLoopSourceRef light_sensor_notify_rl_source;
+#endif
 
     struct mp_log *log;
 
@@ -232,8 +235,18 @@ static void cocoa_init_light_sensor(stru
 
         // subscribe to notifications from the light sensor driver
         s->light_sensor_io_port = IONotificationPortCreate(kIOMasterPortDefault);
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
         IONotificationPortSetDispatchQueue(
             s->light_sensor_io_port, dispatch_get_main_queue());
+#else
+        if ((s->light_sensor_notify_rl_source = IONotificationPortGetRunLoopSource (s->light_sensor_io_port)) != NULL) {
+            CFRunLoopAddSource (CFRunLoopGetCurrent (), s->light_sensor_notify_rl_source, kCFRunLoopCommonModes);
+        }
+        else {
+            MP_WARN (vo, "can't start ambient light sensor connection\n");
+            return;
+        }
+#endif
 
         io_object_t n;
         IOServiceAddInterestNotification(
@@ -255,6 +268,13 @@ static void cocoa_init_light_sensor(stru
 static void cocoa_uninit_light_sensor(struct vo_cocoa_state *s)
 {
     if (s->light_sensor_io_port) {
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
+        if (s->light_sensor_notify_rl_source) {
+            CFRunLoopSourceInvalidate (s->light_sensor_notify_rl_source);
+            s->light_sensor_notify_rl_source = NULL;
+        }
+#endif
+
         IONotificationPortDestroy(s->light_sensor_io_port);
         IOObjectRelease(s->light_sensor);
     }
