Embed two players in a page

In this example, we embed two Nimbb Players in one page. We also see how to interact between the players.

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

Example


Record a video with the player on the left and click Save to view the video on the player on the right.

HTML code

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

// Global variables to hold the players' references.
var _Nimbb1;
var _Nimbb2;

// Event: Nimbb Player has been initialized and is ready.
function Nimbb_initCompleted(idPlayer)
{
  // Let's see which player is calling the event and get references to the players.
  switch(idPlayer)
  {
    case "nimbb1":
      _Nimbb1 = document[idPlayer];
      break;
    case "nimbb2":
      _Nimbb2 = document[idPlayer];
      break;
  }
}

// Event: the video was saved.
function Nimbb_videoSaved(idPlayer)
{
  var guid;
	
  // Make sure that the first player is generating this event.
  if( idPlayer == "nimbb1" )
  {
    // Get the GUID of the saved video.
    guid = _Nimbb1.getGuid();
				
    // Assign the GUID to the second player.
    _Nimbb2.setGuid(guid);
		
    // Start playback now.
    setTimeout(_Nimbb2.playVideo(), 2000);
  }
}

// -->
</script>
Record a video with the player on the left and click Save to view the video on the player on the right.
<br><br>

<object id="nimbb1" 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="http://player.nimbb.com/nimbb.swf?mode=record&key=XXXXXXXXXX&simplepage=1&lang=en" />
<param name="allowScriptAccess" value="always" />
<embed name="nimbb1" src="http://player.nimbb.com/nimbb.swf?mode=record&key=XXXXXXXXXX&simplepage=1&lang=en" width="320" height="240" allowScriptAccess="always" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash">
</embed>
</object>

<object id="nimbb2" 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="http://player.nimbb.com/nimbb.swf?guid=9a906a30ba&lang=en" />
<param name="allowScriptAccess" value="always" />
<embed name="nimbb2" src="http://player.nimbb.com/nimbb.swf?guid=9a906a30ba&lang=en" width="320" height="240" allowScriptAccess="always" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash">
</embed>
</object>


In the code, we added two players and named them nimbb1 and nimbb2. It is important to give distinctive names to the players to trap the events from the appropriate players.

For example, take a look at the Nimbb_initCompleted event. You can see that we defined a switch statement so that we can get references to the players.

With this code, you can see how easy it is to have multiple Nimbb players interact together.

View more tutorials.

SIGN UP NOW 7-day free trial

Check out our Developer guide to get started with Nimbb.