javascriptbrowsercameraperipherals

Is it possible to interact with an arbitrary client peripheral from a webapp?


I know a webapp can access media devices like microphones and webcams, and other hardware like a smartphone's GPS. As far as I know, that's done with tightly constrained protocols for each specific type of device.

However, I have an advanced scientific camera. It is only useful with a computer - it ships with a desktop application for controlling it and taking photos. It also ships with a C/C++ SDK to interface with it in your own applications.

The browser obviously doesn't recognize it as a webcam. Even if it did, all but the most basic functionality would be ignored. The camera is on the client side. Is it possible to write a webapp that can interface with that camera and use all of its features? I'm not looking for a full solution, I just don't even know what to google.

Any amount of hand-rolled solution is fair game here. Anything from plain JavaScript to browser plug-ins to a custom desktop middleware psuedo-driver to sit between the hardware and the camera and the browser. Even binding the client to a specific OS is fine.


Solution

  • You can do basic video capture and screen grabs with Silverlight: https://msdn.microsoft.com/en-us/library/ff602282(v=vs.95).aspx

    It also scriptable by Javascript: https://msdn.microsoft.com/en-us/library/cc645085(v=vs.95).aspx

    Problem is, Silverlight is going away. Officially not until October 2021 though so that might still be an option until the browser vendors come online with HTML 5 Media Capture and Streams: http://w3c.github.io/mediacapture-main/getusermedia.html

    Anything beyond basic capture though, your probably looking at a custom browser extension to control the camera's functions thought it's provided API