Documentation

Ad Scheduler

Features summary

  • Insert pre-roll, mid-roll and/or post-roll ads at designated timestamps
  • Compatible with on-demand and live media content for desktop and mobile devices
  • Works with Google IMA SDK and rmp-vast
  • Use client side waterfalling to maximize fill-rate
  • Does not require VMAP support

1 pre-roll, 2 mid-roll at 30s and 60s, 1 post-roll video ads - see this example here

<script src="https://cdn.radiantmediatechs.com/rmp/9.14.1/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
  // Streaming source - MP4 progressive download in this example
  const src = {
    mp4: [
      'https://your-mp4-url.mp4'
    ]
  };
  // Define ad-schedule
  const schedule = {
    // Preroll
    preroll: 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml',
    // Midroll
    midroll: [
      [30, 'https://www.radiantmediaplayer.com/vast/tags/inline-linear-skippable.xml'],
      [60, 'https://www.radiantmediaplayer.com/vast/tags/inline-linear-skippable.xml']
    ],
    // Postroll
    postroll: 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml'
  };
  const settings = {
    licenseKey: 'your-license-key',
    width: 640,
    height: 360,
    src: src,
    contentMetadata: {
      poster: [
        'https://your-poster-url.jpg'
      ]
    },
    ads: true,
    // Pass ad schedule
    adSchedule: schedule
  };
  const rmp = new RadiantMP('rmp');
  rmp.init(settings);
</script>

Using percent to add mid-roll ads

<script src="https://cdn.radiantmediatechs.com/rmp/9.14.1/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
  // Streaming source - HLS in this example
  const src = {
    hls: 'https://your-hls-url.m3u8'
  };
  // Define ad-schedule
  const schedule = {
    // Preroll
    preroll: 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml',
    // Midroll
    midroll: [
      ['5%', 'https://www.radiantmediaplayer.com/vast/tags/inline-linear-skippable.xml'],
      ['50%', 'https://www.radiantmediaplayer.com/vast/tags/inline-linear-skippable.xml']
    ],
    // Postroll
    postroll: 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml'
  };
  const settings = {
    licenseKey: 'your-license-key',
    width: 640,
    height: 360,
    src: src,
    contentMetadata: {
      poster: [
        'https://your-poster-url.jpg'
      ]
    },
    ads: true,
    // Pass ad schedule
    adSchedule: schedule
  };
  const rmp = new RadiantMP('rmp');
  rmp.init(settings);
</script>

You can combine both percent-based values and second-based values for midroll attribute

Cycling video ads in a live stream

For live video streaming you can display mid-roll video ads at fixed or flexible intervals. In the following example a pre-roll is played when the live player is started and mid-roll video ads are played every 2 minutes (when the player is not paused) for the first 10 minutes of the live stream:

<script src="https://cdn.radiantmediatechs.com/rmp/9.14.1/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
  // Streaming source - HLS in this example
  const src = {
    hls: 'https://your-live-hls-url.m3u8'
  };
  // Define ad schedule
  const schedule = {
    // Preroll
    preroll: 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml',
    // Midroll: a mid-roll ad is played every 120 seconds (2 minutes) for the first 10 minutes of live video
    midroll: [
      [120, 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml'],
      [240, 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml'],
      [360, 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml'],
      [480, 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml'],
      [600, 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml']
    ]
  };
  const settings = {
    licenseKey: 'your-license-key',
    width: 640,
    height: 360,
    src: src,
    contentMetadata: {
      poster: [
        'https://your-poster-url.jpg'
      ]
    },
    ads: true,
    // Pass ad schedule
    adSchedule: schedule
  };
  const rmp = new RadiantMP('rmp');
  rmp.init(settings);
</script>

Mid-roll video ads using the midrollRepeat attribute (live or on-demand video)

The midrollRepeat attribute lets you repeat a request to a specific adTag at regular intervals.

<script src="https://cdn.radiantmediatechs.com/rmp/9.14.1/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
  // Streaming source - MP4 progressive download in this example
  const src = {
    mp4: [
      'https://your-mp4-url.mp4'
    ]
  };
  // Define ad schedule
  const schedule = {
    // Preroll
    preroll: 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml',
    // Midroll: every 60 seconds the player will attempt to load a video ad at the given URL.
    midrollRepeat: [60, 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml']
  };
  const settings = {
    licenseKey: 'your-license-key',
    width: 640,
    height: 360,
    src: src,
    contentMetadata: {
      poster: [
        'https://your-poster-url.jpg'
      ]
    },
    ads: true,
    // Pass ad schedule
    adSchedule: schedule
  };
  const rmp = new RadiantMP('rmp');
  rmp.init(settings);
</script>

Waterfalling with ad scheduling

The adScheduleWaterfall setting will let you add client-side waterfalling to your ad-schedule.

<script src="https://cdn.radiantmediatechs.com/rmp/9.14.1/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
  // Streaming source - MP4 progressive download in this example
  const src = {
    hls: 'https://your-hls-url.m3u8'
  };
  const adScheduleWaterfall = [
    'https://your-fallback-ad-tag-url-1',
    'https://your-fallback-ad-tag-url-2',
    'https://your-fallback-ad-tag-url-3'
  ];
  // Define ad schedule
  const schedule = {
    // Preroll
    preroll: 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml',
    // Midroll at 30 seconds
    midroll: [
      [30, 'https://www.radiantmediaplayer.com/vast/tags/inline-linear-skippable.xml']
    ],
    // Postroll
    postroll: 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml'
  };
  const settings = {
    licenseKey: 'your-license-key',
    width: 640,
    height: 360,
    src: src,
    contentMetadata: {
      poster: [
        'https://your-poster-url.jpg'
      ]
    },
    ads: true,
    // Pass ad schedule
    adSchedule: schedule,
    // Pass waterfall Array for ad schedule
    adScheduleWaterfall: adScheduleWaterfall
  };
  const rmp = new RadiantMP('rmp');
  rmp.init(settings);
</script>

Custom schedule callback

The adScheduleCallback setting will let you add a custom callback before video ads are requested in an ad-schedule.

<script src="https://cdn.radiantmediatechs.com/rmp/9.14.1/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
  const src = {
    hls: 'https://your-hls-url.m3u8'
  };
  const elementID = 'rmp';
  const rmp = new RadiantMP(elementID);
  const adTagUrl = 'https://www.radiantmediaplayer.com/vast/tags/inline-linear-1.xml';
  // Custom callback that will be run before an ad in the schedule is called
  // It must return a Promise that resolves to a valid VAST tag URL
  const adScheduleCallback = function () {
    return new Promise(resolve => {
      rmp.pause();
      setTimeout(() => {
        console.log(adTagUrl);
        resolve(adTagUrl);
      }, 2500);
    });
  };
  const settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    ads: true,
    autoplay: true,
    muted: true,
    // we pass our adScheduleCallback
    adScheduleCallback: adScheduleCallback,
    adSchedule: {
      // preroll, since a callback will be run we just input 'callback'
      preroll: 'callback',
      // midroll, since a callback will be run we just input 'callback'
      midroll: [
        [30, 'callback']
      ],
      // postroll, since a callback will be run we just input 'callback'
      postroll: 'callback'
    },
    contentMetadata: {
      poster: [
        'https://www.radiantmediaplayer.com/images/poster-rmp-showcase.jpg'
      ]
    }
  };
  rmp.init(settings);
</script>

We have also published an example for using adScheduleCallback setting to enable header bidding through Prebid.js in an ad-schedule in our GitHub repository.

Additional support notes

  • Mid-roll timestamps must be expressed in seconds
  • For live video content do not include post-roll data as this would be irrelevant
  • The midrollRepeat setting is capped at 50 midroll ads impression
  • Mid-roll or post-roll video ads are not supported with DVR streaming (only pre-roll linear video ads or overlay ads are currently supported)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License.

©2015-2024 Radiant Media Player. All Rights Reserved.