Get the GUID of a recorded video

Recording video on your site is simple, but how can you get the GUID of the newly saved video? This example shows you the answer. It goes a step further by integrating validation. You could easily modify the code to create a visual feedback form for your site!

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

Example

Your name:



Submit form!

HTML code

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

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

// Global variable to hold the guid of the recorded video.
var _Guid = "";

// 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)
{
  _Guid = _Nimbb.getGuid();
}

// Get the data from the form, which are the name and the video's guid.
// Check that everything is completed.
function submit()
{
  var box = document.getElementById("nameTextBox");
	
  // Make sure the name is specified.
  if( box.value == "" )
  {
    alert("Please enter your name to proceed.");
    return;
  }
	
  // Verify that the video is not currently recording.
  if( _Nimbb.getState() == "recording" )
  {
    alert("The video is being recorded. Please wait.");
    return;
  }
	
  // Check that video has been recorded.
  if( _Guid == "" )
  {
    alert("You did not save the video.  Click save.");
    return;
  }
	
  alert(box.value + ", your video GUID is " + _Guid);
}

// -->
</script>
Your name: <input id="nameTextBox" type="text" name="name" style="width:200px;">
<br><br>

<object id="nimbb" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="320" height="240" codebase= "http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="https://player.nimbb.com/nimbb.swf?mode=record&simplepage=1&key=XXXXXXXXXX&lang=en" />
<param name="allowScriptAccess" value="always" />
<embed name="nimbb" src="https://player.nimbb.com/nimbb.swf?mode=record&simplepage=1&key=XXXXXXXXXX&lang=en" width="320" height="240" allowScriptAccess="always" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash">
</embed>
</object>

<br><br>
<a href="javascript:submit();">Submit form!</a>

In the code, note the event Nimbb_videoSaved() where we get and keep the value of the guid of the recorded video.

Also, you can see the use of simplepage. This parameter tells the player to display a short message after the user has clicked on Save.

Finally, the submit() function validates the form.

View more tutorials.

SIGN UP NOW 7-day free trial

Check out our Developer guide to get started with Nimbb.