Code is not executed in Processing, but in p5.js Web Editor

Thanks for the reply. Yes, I should have written that. I have 2 webcams on my PC and would like to read the ID of both, or then use them in the connection, therefore deviceList[1]…

I also tried the code with my Chrome browser and get the following output:

response_Chrome

However, if I paste the code back into the p5.js online web editor I get the following as a response:

videoinput: HD Pro Webcam C920 (046d:082d) id = 3ff1dc25d725025fc915c7064c6eaee3a4dfb92658f8b0064770f6c9204872c6
videoinput: HD Webcam (04f2:b71a) id = c19baf8272627d653c907eda9908783b32d4f5b58c90f3887098fdfeab477551

So it is working there.

I don’t think it’s because the deviceList[0] is not loading fast enough. If I remove the comments in the last two lines and display the current device name and ID, it works…

(I mean the following lines of the original code)

//      console.log("Device name :", devices[i].label);
//      console.log("DeviceID :", devices[i].deviceId);