adSchedule: Oject
adSchedule.preroll: String
adSchedule.midroll: [Number, String][]
adSchedule.postroll: String
Pass an ad-schedule to the player. See below for examples. Mid-roll timestamps must be passed in seconds but the player will do its best to honor sub-second precision (1.2s === 1200ms). Default: {}.
adScheduleReloadOnEnded : Boolean
When content ends and ad-schedule has finished delivering all advertisement, if viewer requests to view
content again re-deploy ad-schedule. Default: true.
<script src="https://cdn.radiantmediatechs.com/rmp/10.7.5/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' }; // Define ad-schedule const adSchedule = { // Preroll preroll: 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml', // Midroll midroll: [ [30.5, '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, contentMetadata: { poster: [ 'https://your-poster-url.jpg' ] }, ads: true, // Pass ad schedule adSchedule }; const rmp = new RadiantMP('rmp'); // Initialization ... and done! async function initRmpPlayer() { try { await rmp.init(settings); } catch(error) { console.error('Radiant Media Player failed to initialize', error); } } initRmpPlayer(); </script>
<script src="https://cdn.radiantmediatechs.com/rmp/10.7.5/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 adSchedule = { // 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, contentMetadata: { poster: [ 'https://your-poster-url.jpg' ] }, ads: true, // Pass ad schedule adSchedule }; const rmp = new RadiantMP('rmp'); // Initialization ... and done! async function initRmpPlayer() { try { await rmp.init(settings); } catch(error) { console.error('Radiant Media Player failed to initialize', error); } } initRmpPlayer(); </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/10.7.5/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 adSchedule = { // 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, contentMetadata: { poster: [ 'https://your-poster-url.jpg' ] }, ads: true, // Pass ad schedule adSchedule }; const rmp = new RadiantMP('rmp'); // Initialization ... and done! async function initRmpPlayer() { try { await rmp.init(settings); } catch(error) { console.error('Radiant Media Player failed to initialize', error); } } initRmpPlayer(); </script>
The
midrollRepeat attribute lets you repeat a request to a
specific adTag at
regular intervals.
<script src="https://cdn.radiantmediatechs.com/rmp/10.7.5/js/rmp.min.js"></script> <div id="rmp"></div> <script> // Streaming source - HLS for example const src = { hls: 'https://your-hls-url.m3u8' }; // Define ad schedule const adSchedule = { // 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, contentMetadata: { poster: [ 'https://your-poster-url.jpg' ] }, ads: true, // Pass ad schedule adSchedule }; const rmp = new RadiantMP('rmp'); // Initialization ... and done! async function initRmpPlayer() { try { await rmp.init(settings); } catch(error) { console.error('Radiant Media Player failed to initialize', error); } } initRmpPlayer(); </script>
The
adScheduleWaterfall setting will let you add client-side waterfalling to
your ad-schedule.
<script src="https://cdn.radiantmediatechs.com/rmp/10.7.5/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 adSchedule = { // 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, contentMetadata: { poster: [ 'https://your-poster-url.jpg' ] }, ads: true, // Pass ad schedule adSchedule, // Pass waterfall Array for ad schedule adScheduleWaterfall }; const rmp = new RadiantMP('rmp'); // Initialization ... and done! async function initRmpPlayer() { try { await rmp.init(settings); } catch(error) { console.error('Radiant Media Player failed to initialize', error); } } initRmpPlayer(); </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/10.7.5/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,
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'
]
}
};
// Initialization ... and done!
async function initRmpPlayer() {
try {
await rmp.init(settings);
} catch(error) {
console.error('Radiant Media Player failed to initialize', error);
}
}
initRmpPlayer();
</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.
adScheduleConfiguration getter|setter (AdSchedule)
// getter const adScheduleConfiguration = rmp.adScheduleConfiguration; // setter rmp.adScheduleConfiguration = { preroll: 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml', midroll: [ ['15%', 'https://www.radiantmediaplayer.com/vast/tags/inline-linear-skippable.xml'], ['50%', 'https://www.radiantmediaplayer.com/vast/tags/inline-linear-skippable.xml'] ], postroll: 'https://www.radiantmediaplayer.com/vast/tags/inline-linear.xml' };
get|set the current ad-schedule for the player - you may want to call adScheduleConfiguration setter when
setSrc API method resolves to apply a different ad-schedule when loading a new content source.
©2015-2025 Radiant Media Player. All Rights Reserved.