Integrating JW Player with IQ Using the JS SDK

The Ooyala JW Player adapter uses the Ooyala IQ JavaScript SDK to communicate JW Player events to Ooyala IQ. The Ooyala JW Player adapter currently supports versions 6 and 7 of JW Player. You can implement this adapter yourself, or Ooyala Professional Services can help you implement the adapter for a fee. Complete the following steps to integrate JW Player 6 with Ooyala IQ.

Prior to using the JW Player adapter, you need to make sure that your Ooyala assets are playable on third-party players.
  1. JW Player supports playing .mp4 assets. Check that your account has the correct encoding profile to allow .mp4 files to be encoded. You can ask your account manager for assistance checking your processing profile.
  2. If you had to enable .mp4 files to be encoded in your encoding profile, you will need to upload a new video file or re-encode the video file in order to get the newly generated .mp4 file. Content replacement (replacing an asset) will not work for this step. You must upload a new file or open a support ticket with Ooyala Technical Support to reprocess the video without manually uploading it again to keep the same embed code.
  1. Reference analytics.js at https://analytics.ooyala.com/static/analytics.js in the page where your player is hosted. This needs to be done for any page that has a player.
    Warning: Do not host analytics.js on your own. If you do so, you will not receive bug fixes and updates. Please use the Ooyala-hosted version at https://analytics.ooyala.com/static/analytics.js.
  2. Include the following at the page level when you create each player. In this example, jwPlayer is the JW Player object. Replace jwPlayer with your own object name.
    var jwOoyalaReporter = Ooyala.Analytics.JWReporter("yourOoyalaPcodeHere", jwPlayer)

    For example:

    <script type="text/javascript">
      var jwPlayer = jwplayer("video").setup({
        file: 'http://content.jwplatform.com/videos/test.mp4', mediaid: '12345'});
      var jwOoyalaReporter = Ooyala.Analytics.JWReporter("yourOoyalaPcodeHere", jwPlayer)
    </script>                   
  3. (Optional) Specify a media content type with the MediaContentType parameter to show if the mediaid specifies an Ooyala video asset or a non-Ooyala video asset. You can set the media content type as one of the two following values. If you do not specify a media content type, the default value is EXTERNAL_CONTENT (non-Ooyala media assets).
    • OOYALA_CONTENT: Indicates that the mediaid is an Ooyala embed code. You must use type: 'mp4'. To get the value for file, make the Backlot API query: /assets/<ASSET EMBED CODE>/streams for the asset and copy the encoding with "muxing format" == mp4.
      <script type="text/javascript">
          var jwPlayer = jwplayer("video").setup({
              file: 'pathToYourOoyalaMp4VideoAsset',
              mediaid: 'yourOoyalaEmbedCode',
              type: 'mp4'
          });
          var jwOoyalaReporter = Ooyala.Analytics.JWReporter("<pcode>", jwPlayer, {
              contentType: Ooyala.Analytics.MediaContentType.OOYALA_CONTENT
          });
      </script>
    • EXTERNAL_CONTENT: Indicates that the mediaid is not an Ooyala embed code (and is customer-defined media ID from a non-Ooyala CMS).
      <script type="text/javascript">
          var jwPlayer = jwplayer("video").setup({
          file: 'pathToYourVideoAsset',
          mediaid: 'yourMediaID'
          });
          });
          var jwOoyalaReporter = Ooyala.Analytics.JWReporter("<pcode>", jwPlayer, {
              contentType: Ooyala.Analytics.MediaContentType.EXTERNAL_CONTENT
          });
      </script>
    Note: The Ooyala IQ JavaScript SDK does not support specifying multiple content types within the same player instance in a page. However, we do support specifying multiple content types for different players on the same page. For example, we do not support analytics for the use case where you have one player on a page that plays Ooyala video assets and external assets. We do support analytics for the use case where you have two players on the same page where one plays Ooyala video assets and the other plays external (non-Ooyala video assets).

Was this article helpful?