FreeWheel (beta)

To configure the FreeWheel plugin:

Add the FreeWheel AdManager SDK and player styles, and import the FreeWheel plugin:

import "@castlabs/prestoplay/cl.freewheel";
<link rel="stylesheet" href="clpp.styles.css">
<script src="//adm.stg.fwmrm.net/libs/adm/6.37.0/AdManager.js"></script>

Add the FreeWheel customer data to the player configuration:

const playerConfig = {
  // ...
  freewheel: {
    networkId: 42015,
    serverUrl: '//demo.v.fwmrm.net/ad/g/1',
    profileId: '42015:js_allinone_profile',
    videoAssetId: 'js_allinone_demo_video',
    pods: [
      { id: 'Preroll_1', position: 0, type: clpp.ads.PodType.PREROLL },
      { id: 'Midroll_1', position: 3, type: clpp.ads.PodType.MIDROLL },
      { id: 'Midroll_2', position: 30, type: clpp.ads.PodType.MIDROLL },
      { id: 'Postroll_1', position: 60, type: clpp.ads.PodType.POSTROLL }
    ]
  }
};

See FreeWheelConfiguration for all available configuration options.

The whole code can look like this:

<link rel="stylesheet" href="clpp.styles.css">
<script src="//adm.stg.fwmrm.net/libs/adm/6.37.0/AdManager.js"></script>
<video id="video" controls></video>
<button id="playButton">Play</button>
<script type="module">
  import { clpp } from "@castlabs/prestoplay";
  import "@castlabs/prestoplay/cl.mse";
  import "@castlabs/prestoplay/cl.freewheel";

  const player = new clpp.Player('video', ...);

  player.open({
    source: '//demo.cf.castlabs.com/media/prestomp4/presto.mp4',
    freewheel: {
      networkId: 42015,
      serverUrl: '//demo.v.fwmrm.net/ad/g/1',
      profileId: '42015:js_allinone_profile',
      videoAssetId: 'js_allinone_demo_video',
      pods: [
        { id: 'Preroll_1', position: 0, type: clpp.ads.PodType.PREROLL },
        { id: 'Midroll_1', position: 3, type: clpp.ads.PodType.MIDROLL },
        { id: 'Midroll_2', position: 30, type: clpp.ads.PodType.MIDROLL },
        { id: 'Postroll_1', position: 60, type: clpp.ads.PodType.POSTROLL }
      ]
    }
  });

  // Listen to ad events the same way as in the IMA example.

  document.getElementById('playButton').addEventListener('click', () => {
    player.play();
  });
</script>
Previous topic: Yospace