Change the mode of the player

In this example, we change the mode of the Nimbb Player. Using Javascript, we change to playback mode once the recording is completed. We start playing the video automatically and add a link to return to recording mode.

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


Record a video and click Save to change the mode of the player.

Recording mode

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];

// Event: the video was saved.
function Nimbb_videoSaved(idPlayer)
  var guid;

  // Get the GUID of the saved video.
  guid = _Nimbb.getGuid();

  // Set the player in view mode.
  // Assign the GUID.
  // Start playback now.

// Return to recording mode.
function modeRecord()
  // Make sure the player is not in recording mode.
  if( _Nimbb.getMode() == "record" )
    alert("The player is already in recording mode.");
  // Set the player in recording mode.

// -->
Record a video and click Save to change the mode of the player.

<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">

<a href="javascript:modeRecord();">Recording mode</a>

In the code, we use the event Nimbb_videoSaved() to get the video GUID and then set the player in view mode with method setMode().

Also note the function modeRecord(), where we set the player back in recording mode.

View more tutorials.

SIGN UP NOW 7-day free trial

Check out our Developer guide to get started with Nimbb.