I am trying to trigger an event in javascript by clicking the snapshot button of my external webcam. I have the "Speedlink Reflect LED Webcam" with integrated snapshot button. I thought it should not be that hard since it is a some kind of a key it should be easy to detect in javascript with a script similar to this
$(document).on("keypress", function (e) {
//check if e == snapshot button
//do something
});
But actually it does not detect a keypress when I press the button. I don't find any similar article like this in google, did anyone work with that before ?
Well, keypress
is a keyboard event and not an event handler for other such buttons in your hardware. Either the camera driver should have a keyboard event trigger mechanism or else this is not possible in my opinion.
The event you are talking about is triggered by the camera, and the driver of it would capture that event. I have no idea if that even would be captured by the browser but, if it captures I'm sure you would have to implement the rest of the trigger logic. The keypress
event will not trigger at all.