I am developing a Desktop application that lists the webcams connected to the system. When the user selects the web-cam app streams from the device to the QTCaptureView.
I have registered to the notification QTCaptureDeviceWasDisconnectedNotification
and QTCaptureDeviceWasConnectedNotification
so that I remove and add the device to the list whenever device is disconnected and connected.
The problem is that QTCaptureDeviceWasConnectedNotification
is posted twice when a device is connected. What is the reason for this?
Also, in one of my Mac Book I get the following problem frequently. The device obtained from QTCaptureDeviceWasConnectedNotification 2nd notification (I get two notifications) does not have the localized description name. Could you please tell me what might have gone wrong here?
I had the same problem. The reason of such interesting behavior in my case was webcam with built-in microphone. So, when attaching such multi-purpose device there will be two notifications - one for video capture device and second for built-in microphone.
This is list of my general faults that blocked me from understanding the situation (possibly will help you):
Here logs from my test.
On device attach first notification is:
Device++ #0: "AppleHDAEngineInput:1B,0,1,1:4" - "AppleHDA:12"
Device++ #1: "AppleHDAEngineInput:1B,0,1,0:3" - "AppleHDA:12"
Device++ #2: "0xfd100000046d0990" - "UVC Camera VendorID_1133 ProductID_2448"
You can see UVC camera alone. Second notification is:
Device++ #0: "AppleHDAEngineInput:1B,0,1,1:4" - "AppleHDA:12"
Device++ #1: "AppleUSBAudioEngine:Unknown Manufacturer:Logitech Camera:5895DC4F:3" - "AppleUSBAudioDevice:Logitech Camera"
Device++ #2: "AppleHDAEngineInput:1B,0,1,0:3" - "AppleHDA:12"
Device++ #3: "0xfd100000046d0990" - "UVC Camera VendorID_1133 ProductID_2448"
You can see UVC camera and AppleUSBAudioEngine - the microphone.
On device detach there will be two notification also. First one:
Device-- #0: "AppleHDAEngineInput:1B,0,1,1:4" - "AppleHDA:12"
Device-- #1: "AppleHDAEngineInput:1B,0,1,0:3" - "AppleHDA:12"
Device-- #2: "0xfd100000046d0990" - "UVC Camera VendorID_1133 ProductID_2448"
No microphone, UVC camera still there. Second notification:
Device-- #0: "AppleHDAEngineInput:1B,0,1,1:4" - "AppleHDA:12"
Device-- #1: "AppleHDAEngineInput:1B,0,1,0:3" - "AppleHDA:12"
No UVC camera, no microphone.
Also, QTKit possibly can "merge" notifications since sometimes I get only one notification (one for connect and one for disconnect), so actual number of notifications depends not only from number of (sub-)devices connected or disconnected.
For localizedDisplayName - had no problems with it yet.