Closed dragonstone071 closed 7 years ago
@dragonstone071 Thanks for reporting this. I have added this to my radar, but may be a while before I can take a look. Stay tuned. Thanks!
So, I took a look at this and indeed when you start recording from the device, the 'devices'
event is triggered.
However, in my tests, it fires twice: once to show the device has been disconnected and once showing it has been reconnected. While this behavior is unexpected, it's happening inside the MobileDevice framework and is outside the control of node-ios-device.
It's perhaps outside the scope of node-ios-device to delay the 'device' event to protect against this. Given that the list of devices does eventually become correct, I'm going to close this ticket. You can always code around this in your app by using a modified debounce function.
As per documentation:
tractDevices()'s callback should only be triggered when new devices are connected or current devices get disconnected. But I have observed this being called on unlikely events such as, starting QuickTime video recording on a device.
Steps To Reproduce
iosDevice .trackDevices() .on('devices', function (devices) { console.log('Connected devices:'); console.log(devices); }) .on('error', function (err) { console.error('Error!', err); });