Post

Replies

Boosts

Views

Activity

Reply to How to observe AVCaptureDevice.DiscoverySession devices property?
Hi, I tried it and I got the context below when initializing. Change New devices: [ .... ] When I disconnect AirPods, the log Output won't be shown anymore but I got nothing more. When I disconnect the AirPods, it was not shown on Settings app. I tried this code for i in 0..<60 { sleep(1) for device in discovery_session.devices { print(device.localizedName) } } session.stopRunning() Then it seems that the devices list is not updated. This code prints the same content every time while the app is runnning. I don't have EarPods now, so I will try it later.
Oct ’24
Reply to How to observe AVCaptureDevice.DiscoverySession devices property?
Hello, @Engineer, thank you for your reply. I still cannot receive any notification using this code on macOS with AirPods or EarPods. NotificationCenter.default.addObserver(forName: AVCaptureDevice.wasDisconnectedNotification, object: nil, queue: nil) { notification in print("disconnected \(notification)") } I found a similar issue on StackOverflow. https://stackoverflow.com/questions/30789622/avcapturedevice-deviceswithmediatype-does-not-update-after-added-removed-camera I tried the soluon( use AVCaptureDevice.devices() instead of AVCaptureDevice.DiscoverySession.devices() ) in the page, but it doesn't work.
Oct ’24