Permanently allow access to the webcam

Before a user can record a video with the Nimbb Player, the user must allow access to his webcam. This is a requirement by the Adobe Flash Player to protect users from unauthorized use of their webcam. To give access, the user must click Allow on the Privacy setting window.

However, every time the user loads the Nimbb Player, this security window shows up. If a user must access the Nimbb Player often, this can be a little annoying.

The solution is to display the Privacy setting window that also includes a Remember checkbox, allowing Flash to remember the security setting. By enabling both "Allow" and "Remember", the Nimbb Player will be able to always access the webcam.

You can try it in the following example. Notice that you can now click "Allow" and "Remember". Once you complete this, reload the page and the security window will not appear anymore.

This example requires you to specify your developer key (see tutorial).


HTML code

<script language="JavaScript" type="text/javascript">

// Global variable to hold player's reference.
var _Nimbb;

// Event: Nimbb Player has been initialized and is ready.
function Nimbb_initCompleted(idPlayer)
  // Get a reference to the player since it was successfully created.
  _Nimbb = document[idPlayer];
  // Did the user allowed access to the webcam?
  if( !_Nimbb.isCaptureAllowed() )
    // No, display the Privacy window with a "Remember" checkbox.

// Event: the user changed privacy settings for allowing access to camera/microphone.
function Nimbb_captureChanged(idPlayer, allowed)
  if( allowed == 'true' )
    // The user clicked "Allow".
    alert("Make sure to check 'Remember' and then click 'Close'.");
  else if( allowed == 'false' )
    // The user has not allowed access to webcam.  Show warning and display the Privacy window again.
    alert("You need to allow access to your webcam.  Please click 'Allow'.");

// -->
<object id="nimbb" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="320" height="240" codebase= "">
<param name="movie" value="" />
<param name="allowScriptAccess" value="always" />
<embed name="nimbb" src="" width="320" height="240" allowScriptAccess="always" pluginspage="" type="application/x-shockwave-flash">

In the code, we first wait for the Nimbb Player to complete initialization. Then, we verify if the Nimbb Player has access to the webcam using the isCaptureAllowed() method. If not, we force the display of the Privacy setting window by calling the method showPrivacySettings(). By calling this method, the user will see the Privacy window with a "Remember" checkbox available.

In the Nimbb_captureChanged() event, we verify that the user clicks "Allow" and then display a message asking to check "Remember". In case the user denies access, we display a warning and re-open the Privacy window.

Remember: the user can open the Privacy window at any time by clicking the little camera image in the upper-right corner of the Nimbb Player.

View more tutorials.

SIGN UP NOW 7-day free trial

Check out our Developer guide to get started with Nimbb.