tags:

views:

22

answers:

3

My web-app records users via webcam and microphone. I want to use HTML/JS for the controls and content, so I created two separate Flex modules:
* A "Webcam Setup" module that lets you choose your camera and mic input devices
* A "record" module that lets the user record and submit the recording

When I embed either of these on the page, since they access the user's Camera/Mic object, Flash shows the Privacy dialog that says "[mysite] is requesting access to your camera and microphone. If you click Allow, you may be recorded."

The problem is, if I answer Yes in the Setup module, and later add the Record module to the page using Javascript, it again shows the Privacy dialog.

Is there a way to avoid the second privacy popup?

I would think that saying "Yes" for [mysite] would store that permission for at least that session, but apparently not.

What I've tried
I tried combining them into one SWF, adding it to the page once and moving the DOM element with jQuery's append() function when needed. When I move it, however, it reloads and asks me again.

A: 

Imagine if [mysite] was, say, blogger.com or livejournal.com (or, if it were still around, geocities.com). Would you want a "yes" response on that site to be good for every page under that domain?

Rememeber, just because you promise (cross your heart & hope to die) not to abuse the security hole you request, doesn't mean they can allow you to have that security hole.

James Curran
Makes sense :). Seems there could be a "1 warning per *page*", though, but I guess if the modules are separated, Flash doesn't know or care about possible other Flash objects on the page... Thing is, I've seen a site that separates the setup from the recording, but I can't figure out how it's done :/. Let me know if you know of any clever workarounds!
Taylor Campbell
A: 

Eventually, I found a usable workaround, similar to what I originally tried (above).

I combined the setup and record modules into one SWF. I first show the setup screen. When the user hits the Continue button on my page, Javascript calls a function in the SWF to swap to the Record screen. I then move the <div> containing the Flash object to another location on page using absolute positioning, and resize the object.

Previously, I was trying to use jQuery's append() function to move the div within the DOM, and that was causing the SWF to reload. Just changing position and size does actually work.

Taylor Campbell
A: 

You could build the "record" component to simply send and receive signals using an API you've created for your "setup" component (which has already been authorized, meaning one auth & two swfs) by using the LocalConnection class: http://livedocs.adobe.com/flex/3/langref/flash/net/LocalConnection.html

This seems far closer to best practice than the other implementations mentioned, which smell a bit hacky and would probably confuse anyone who may inherit the codebase in the future.

jooks
Taylor Campbell
Though both components "use" the webcam and mic, by invoking methods on the setup component using signals[e.g. In record component: localConnection.send('setupConnection', 'startRecording')] you should be able to in effect remote control the SWF that has already gained permission to use the webcam/microphone. If you need any of the media data from the webcam/microphone in the record SWF, you may find restriction in the 40KB message size per invocation via LocalConnection. A 'signal' is what is sent by "send()" on LocalConnection.
jooks