Custom Adaptive Plugin


Custom OVP Integration – Get Started


Sample Javascript: 


videojs.plugin.js
  var irisOptions = {
        settings: {
          number: 5,
          platform: "videojs", // optional
          access_token: <ACCESS TOKEN>,
		  client_token: <CLIENT_TOKEN>,
		  api_url: '//api.iris.tv', // optional (should only be used if you would like to use the non-default API-url
          ssl: true, // optional (determines whether to make API calls, load assets, etc. over http or https,
          player_version: 'videojs', // optional
          start_up_next: true, // optional. Creates the "Up Next" block at the beginning of a video
          end_up_next: true, // optional. Creates the "Up Next" block at the end of a video
          player_id: <HTML ID of the Player Element>, 
		  platform_id: <PLATFORM_ID>
        },
        iris_buttons: { // optional. determines whether to show iris UI elements. 
          thumbs_up: true, 
          thumbs_down: true, 
          skip_forward: true, 
          skip_back: true
        }, 
		player_elements: {
		  video_player: videojs(player_id)
		},
        debug: true, // for development only. Logs additional information in the JS console.
		global: 'irisPlayer' // optional. Sets a global var accessible through the JS console. 
      }

  function currentTime(id){
    try {
      return videojs.getPlayers()[id].currentTime();
    }
    catch (err) {
      console.log(err);
      return 0
    }
  }
  // Create currentDuration() function that gets the currentDuration of the current video. In VideoJS's case, we have added an [id] argument to grab a specific video player in the case that there are multiple players on a single page. 
  function currentDuration(id) {
    try {
      return videojs.getPlayers()[id].duration();
    }
    catch (err) {
      console.log(err);
      return 0
    }
  }


  // Make the IrisEngine variable global if you would like to access it in other pages or the DOM	
  IrisEngine = initializeIrisPlugin(irisOptions);
  IrisEngine.registerFunction("currentTime", currentTime);
  IrisEngine.registerFunction("currentDuration", currentDuration);

And in the HTML, you would add two script tags to reference the iris.adaptive.min.js file and the videojs.plugins.js

  <script src="//ovp.iris.tv/libs/adaptive/v2/iris.adaptive.js" type="text/javascript"></script>
  <script src="videojs.plugin.js" type="text/javascript"></script> <!-- link to your own plugin file -->


Example VideoJS Plugin Implementation

IRIS.TV Adaptive Plugin This is an example implementation of a custom plugin. This example uses a videojs video player.

https://s3.amazonaws.com/ovp.iris.tv/shared/docs/example-videojs-doc.html




IRIS.TV