Bug: Unplugging a camera in capturing breaks device enumeration

%3CLINGO-SUB%20id%3D%22lingo-sub-3290136%22%20slang%3D%22en-US%22%3EBug%3A%20Unplugging%20a%20camera%20in%20capturing%20breaks%20device%20enumeration%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3290136%22%20slang%3D%22en-US%22%3E%3CP%3ECamera%20device%20may%20not%20be%20removed%20from%20navigator.mediaDevices.enumerateDevices()%20after%20being%20unplugged.%20We%20tested%20several%20PCs%20with%20Windows%2010%20installed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20modified%20a%20sample%20of%20WebRTC%20a%20bit%2C%20which%20could%20help%20reproduce%20this%20issue.%20Here%20is%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fshaqi86%2Fwebrtc-samples%2Ftree%2Fgh-pages%2Fsrc%2Fcontent%2Fdevices%2Finput-output%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Esample%20code.%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ESteps%20to%20Reproduce%3C%2FSTRONG%3E%3A%3C%2FP%3E%3CP%3E1)%20Open%20the%20demo%20in%20Edge%20(build%20and%20run%20the%20web%20server%20first).%3C%2FP%3E%3CP%3E2)%20Select%20an%20external%20camera%20and%20approve%20the%20access.%3CBR%20%2F%3E3)%20After%20capturing%20started%2C%20unplug%20the%20camera.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EExpected%20Result%3C%2FSTRONG%3E%3A%3C%2FP%3E%3CP%3EUnplugged%20camera%20device%20should%20be%20removed%20from%20enumerateDevices().%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EActual%20Result%3C%2FSTRONG%3E%3A%3C%2FP%3E%3CP%3EUnplugged%20camera%20device%20is%20not%20removed%20from%20enumerateDevices().%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt's%20not%20reproducible%20always%2C%20and%20possibility%20varies%20with%20different%20machines.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3290136%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECamera%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EEdge%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ewebrtc%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3318838%22%20slang%3D%22en-US%22%3ERe%3A%20Bug%3A%20Unplugging%20a%20camera%20in%20capturing%20breaks%20device%20enumeration%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3318838%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F309365%22%20target%3D%22_blank%22%3E%40josh_bodner%3C%2FA%3E%26nbsp%3BNot%20yet%20in%20Chrome.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3301939%22%20slang%3D%22en-US%22%3ERe%3A%20Bug%3A%20Unplugging%20a%20camera%20in%20capturing%20breaks%20device%20enumeration%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3301939%22%20slang%3D%22en-US%22%3ECan%20you%20also%20get%20the%20same%20thing%20to%20happen%20in%20Chrome%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3335892%22%20slang%3D%22en-US%22%3ERe%3A%20Bug%3A%20Unplugging%20a%20camera%20in%20capturing%20breaks%20device%20enumeration%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3335892%22%20slang%3D%22en-US%22%3EOkay%2C%20it%20sounds%20like%20this%20may%20in%20fact%20be%20our%20bug%2C%20so%20I'll%20get%20somebody%20to%20look%20into%20it.%3C%2FLINGO-BODY%3E
New Contributor

Camera device may not be removed from navigator.mediaDevices.enumerateDevices() after being unplugged. We tested several PCs with Windows 10 installed.

 

I modified a sample of WebRTC a bit, which could help reproduce this issue. Here is the sample code.

 

Steps to Reproduce:

1) Open the demo in Edge (build and run the web server first).

2) Select an external camera and approve the access.
3) After capturing started, unplug the camera.

 

Expected Result:

Unplugged camera device should be removed from enumerateDevices().

 

Actual Result:

Unplugged camera device is not removed from enumerateDevices().

 

It's not reproducible always, and possibility varies with different machines.

3 Replies
Can you also get the same thing to happen in Chrome?
Okay, it sounds like this may in fact be our bug, so I'll get somebody to look into it.