How to make the app communicate with the camera extension?

I create a camera extension and App can push video data to camera extension with sinkStream. I want to monitor the number of clients connected to the camera extension and close the app's push stream when the number of connected client is zero.

Replies

There’s a lot of info about IPC in the CMIO context in this thread.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

you can override connectClient and disconnectClient if you want to monitor connected clients. Make the number of connected clients a property of your extension.

To communicate this asynchronously to your app, you can call notifyPropertiesChanged in your extension. In the app, install a notification handler using CMIOObjectAddPropertyListener.

  • can you provide a usage example of CMIOObjectAddPropertyListener? There is no official document on this

Add a Comment

the only documentation is in the header files CoreMediaIO/CMIOHardwareObject.h. You set up a listener proc with an array of property addresses you want to be notified about. You can use a block-based or straightforward function-based callback. In your callback function or block, you'll get a list of property addresses which have notified you, but no further information (such as the property values). All that the callback is telling you is "this property changed", you have to make a call into your extension to get the value of the property of properties you have been notified about.