<script src="https://cdn.radiantmediatechs.com/rmp/9.16.6/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>
<script src="https://cdn.radiantmediatechs.com/rmp/9.16.6/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
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.16.6/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>
The
midrollRepeat
attribute lets you repeat a request to a
specific adTag at
regular intervals.
<script src="https://cdn.radiantmediatechs.com/rmp/9.16.6/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>
The
adScheduleWaterfall
setting will let you add client-side waterfalling to
your ad-schedule.
<script src="https://cdn.radiantmediatechs.com/rmp/9.16.6/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>
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.16.6/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.
midrollRepeat
setting is capped at 50 midroll ads
impression
©2015-2024 Radiant Media Player. All Rights Reserved.