Player plugins

Available plugins

In order to insert a plug-in on your web page, you should specify it in the plugins array property in an initialization settings object passed to rubac('initialize', requestObject) call. You can use the plug-in’s name if it is already loaded, or the URL from which to load it. In case the plug-in has some specific configuration options, you need to use the following structure instead of the plain name / url:

{
  name: 'youtube|path',
  // or
  // url:'path',
  settings: {...}
}

name - name of the loaded plug-in or the URL from which to load it settings - settings object with the structure defined by the plug-in

By default we supply the following plug-ins:

  • Realeyes.Plugins.Youtube (bundled with Realeyes.Players.Youtube)
  • Realeyes.Plugins.HTML5 (bundled with Realeyes.Players.HTML5)

Realeyes.Plugins.Youtube

This plug-in automatically attaches itself to all YouTube players found on the page (or specified by you using the rubac function). This plug-in has the following optional settings:

{
  autoDetect:'auto|once|off'
}

autoDetect - When ‘off’ it does not automatically try to attach to any of the YouTube players on the page. ‘Once’ tells the plugin to try to attach itself only to players that were already present on page at the time the plug-in was loaded. When set to ‘Auto’, the plug-in will attach itself to all previously-existing players on the page and any additions thereon. ‘Auto’ is the default setting.

The ‘off’ mode is useful when you want to take control of which YouTube players should be tracked, or if you need more specific command over the player initialization and want to use its APIs yourself (for this later case see instructions below!). If that is the case, you can use the rubac function to pass the specific YouTube player API instance to the plug-in:

rubac('application.addPlayer', { player: new Realeyesit.Players.YouTube(playerObject), onReady: function(playerObject) { /* player is added successfully */ } } )

Realeyesit.Players.YouTube - YouTube player unified interface implementation class. Wraps youtubePlayerObject to produce unified interface recognized by our applications. Bundled with YouTube plug-in. youtubePlayerObject - either the YouTube player swf OBJECT|EMBED DOM Element or YT.Player class instance. You will have to include www.youtube.com/iframe_api yourself to use this class. This class is used to expose YouTube iframe players’ JavaScript API.

If you also use the YouTube API yourself, the recommended solution is to include our special script that wraps around the YouTube API permitting its shared usage. In this case just insert it into the header of your page:

<script type="text/javascript" src="//datacollection2cdn.realeyesit.com/DataCollectionSDK/live/plugins/Realeyesit.YouTubePatch.min.js"></script>

NOTE: The YouTube plug-in can’t attach itself to YouTube players hosted in an iframe with origin querystring parameter set to an src attribute. This happens when using a YouTube iframe JavaScript API (YT.Player) to add iframe players on the page and leaving the origin undefined, in which case the API fills in this parameter automatically. Origin parameter restricts access to the YouTube player JavaScript API from our scripts. If you want the plug-in to track such a player’s events, you should use the above rubac function call to pass wrapped player object to plug-in yourself.

Realeyes.Plugins.HTML5

This plug-in automatically attaches itself to all HTML5 video elements found on the page (or specified by you using the rubac function). This plug-in has the following optional settings:

{
  autoDetect:'auto|once|off'
}

The setting is used in the same way than in case of the Youtube plug-in (see above).