views:

335

answers:

3

Can a python script on my server access the webcam and audio input of a user as easily and as well as a Flash plugin can?

A: 

Server-side web scripts have no access to the client other than through requests. You need to use JavaScript, Java, or Flash to access devices that the browser (and consequently user) allows them to.

Ignacio Vazquez-Abrams
How would Javascript be able to access a webcam and a mic? Is there a good tutorial out there?What about using Javascript to access files on a user's desktop?
Ali
+2  A: 

No: the "plugin" you mention runs in the user's browser, your server-side script (Python or otherwise) runs on the server, a completely different proposition. This relates to your other recent question about a server-side script accessing information on your desktop: your client machine tends to be very protected against possibly malicious server-side apps (never enough, but everybody keeps trying to make it more and more protected these days).

Alex Martelli
Thanks for the reply. Even though Flash runs in the client's broswer, the file is first sent from the server. Is it possible to write an app that would download and run from the broswer and provide Flash functionality and could communicate with the server? What about with using HTML 5?
Ali
To "provide Flash functionality", your best bet is to use Flash (and of course you'll lose all users on iPad and iPhone devices). For somewhat flash-like functionality that you could code in Python (as well as C# and other languages), look at Microsoft's Silverlight plugin (or its Moonlight free clone) -- it's somewhat rarely installed at this time, though. For HTML5 support for devices, work is in progress (will be quite a while before you can count on that in production!), cfr e.g. http://stackoverflow.com/questions/1318834/whats-the-status-of-the-html-5-video-tag-and-webcam-integration .
Alex Martelli
A: 

Not as easy, no. But there are extensions you can use. E.g.

A Win32 Python Extension for Accessing Video Devices (e.g. a USB WebCam, a TV-Card, ...)

http://videocapture.sourceforge.net/

Tutorial:

http://technobabbler.com/?p=22

dkamins
Sorry I misread the question... Python on the server can't access the client's hardware. Flash runs on the client. The links I posted would be for a Python app that a client would run.
dkamins