Radiant Media Player

Ads with rmp-vast



Documentation sections


Introduction to rmp-vast

rmp-vast is a lightweight open-source client-side JavaScript solution to load, parse and display VAST resources. It is maintained by Radiant Media Player team and is offered as an alternative to the Google IMA SDK. The main purpose of rmp-vast is to offer a VAST 3 compliant solution to display video ads in web-based mobile applications for iOS and Android (WebView, Ionic, PhoneGap, Cordova ...) as the Google HTML5 IMA SDK is not officially compatible with those environments. rmp-vast can also be used in environments like desktop or mobile browsers.


Supported features with rmp-vast

rmp-vast supports the following VAST 3 features:

  • Inline and Wrapper Ads
  • Linear Ads (MP4/WebM or HLS, DASH where natively supported)
  • Skippable Linear Ads (MP4/WebM or HLS, DASH where natively supported)
  • Non Linear Ads (Images)
  • Tracking Events
  • Error Reporting
  • Industry Icons
  • VAST 3 Macros
  • VPAID 1 and 2 JavaScript
  • Ad Pods
  • Audio Ads (MP3/M4A/OGG/HLS where natively supported) in HTML5 video

VAST 2 resources are also compatible with rmp-vast.

Additional supported features include a mobile friendly UI and autoplay support (muted autoplay on mobiles).

The following VAST/player features are currently not supported with rmp-vast: Companion Ads, VMAP, Audio ads in HTML audio player. Radiant Media Player supports those features through the Google IMA SDK.


Supported environments with rmp-vast

Browsers:

  • Chrome for Android 5+
  • Chrome for Desktop
  • Firefox for Android 5+
  • Firefox for Desktop
  • Safari 10+ for macOS
  • Safari for iOS 10+
  • MS Edge for Desktop
  • Internet Explorer 11+ for Desktop

Specifically we support the latest stable release for each browser.

WebViews:

  • Android 5+
  • iOS 10+

It is fairly possible that rmp-vast would work in other environments but they are not officially supported.


Video ads from Google Ads network and rmp-vast

When serving ads from the Google Ads network (DFP, ADX, AdSense for Video) please take note of the following:

  • DFP: while rmp-vast should render DFP ads we recommend using the IMA HTML5 SDK to display ads coming from DFP servers to benefit from all DFP features
  • ADX & AdSense for Video: you must use the IMA HTML5 SDK to render ads coming from ADX or AdSense for Video servers - rmp-vast may not render those ads which specifically require the IMA HTML5 SDK to run

CORS requirements

rmp-vast uses JavaScript XMLHttpRequests to load VAST tags. Hence proper CORS configuration is required on your ad-server in order for rmp-vast to be able to retrieve VAST tags. Refer to this Google documentation for more information.


Usage example

Player settings for using rmp-vast are very similar to using Google IMA SDK. The only difference resides in specifying the VAST parser which you want to use through the adParser setting.

Here is a complete example:

<!-- Include Radiant Media Player JavaScript file in your <body> or <head> -->
<script src="https://cdn.radiantmediatechs.com/rmp/5.0.10/js/rmp.min.js"></script>
<!-- Player container element -->
<div id="rmpPlayer"></div>
<script>
  // Streaming source - HLS in this example
  var src = {
    hls: 'https://your-hls-url.m3u8'
  };
  // Player settings
  var settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    ads: true,
    // We tell the player to use rmp-vast to load and parse VAST resources
    adParser: 'rmp-vast',
    // We pass our adTag here - the player will attempt to load it upon startup
    adTagUrl: 'https://your-ad-tag-url',
    poster: 'https://your-poster-url.jpg'
  };
  var elementID = 'rmpPlayer';
  var rmp = new RadiantMP(elementID);
  rmp.init(settings);
</script>
<!-- Player container element -->
<div id="rmpPlayer"></div>
<!-- Set up async player configuration options -->
<script>
  // Streaming source - HLS in this example
  var src = {
    hls: 'https://your-hls-url.m3u8'
  };
  // Player settings
    var settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    ads: true,
    // We tell the player to use rmp-vast to load and parse VAST resources
    adParser: 'rmp-vast',
    // We pass our adTag here - the player will attempt to load it upon startup
    adTagUrl: 'https://your-ad-tag-url',
    poster: 'https://your-poster-url.jpg',
    // Here we pass the ID of the player container so that the core library may automatically initialize player when it finishes loading
    asyncElementID: 'rmpPlayer'
  };
  // We push the player settings to a global rmpAsyncPlayers variable
  if (typeof window.rmpAsyncPlayers === 'undefined') {
    window.rmpAsyncPlayers = [];
  }
  window.rmpAsyncPlayers.push(settings);
</script>
<script async src="https://cdn.radiantmediatechs.com/rmp/5.0.10/js/rmp.min.js"></script>

Player settings

ads: Boolean

Activate or not ads within the player. Default: false.

adTagUrl: String

Specifies the ad tag url that is requested by the player from the ad server. Default: ''.
We recommend using fully qualified URLs for the adTagUrl setting

adParser: String

Specifies which VAST parser the player should use. Possible values are 'rmp-vast' and 'ima'. Default: 'ima'.

adLoadVastTimeout: Number

Represents the Ajax timeout in milliseconds for each VAST request (or VAST wrapper). When timeout is reached without a valid server response the VAST loading process is aborted. Default: 5000.

adLoadMediaTimeout: Number

Timeout (in milliseconds) when loading a creative media file (after a successful VAST response). If loading takes longer than this timeout, the ad playback is cancelled and content resumes. Default: 8000 which represents a 8 seconds timeout.

adAjaxWithCredentials: Boolean

AJAX request to load VAST tag from ad server should or should not be made with credentials. Default: false.

adMaxNumRedirects: Number

Specifies the maximum number of redirects before the subsequent redirects will be denied, and the ad load aborted. The number of redirects directly affects latency and thus user experience. This applies to all VAST wrapper ads. Default: 4.

adPauseOnClick: Boolean

When set to true this setting will cause to pause the playing linear ad (or content for a non-linear ad) when the ad is interacted with. Default: true. On some devices the browser may still decide to pause a video asset when a new window opens.

adCountDown: Boolean

A countdown to be displayed within the player control bar. It shows the remaining time for the video ads. Default: false.


Player labels for rmp-vast

See our documentation about player labels here.

var labels = {
  ads: {
    controlBarCustomMessage: 'Ad',
    skipMessage: 'Skip ad',
    skipWaitingMessage: 'Skip ad in',
    textForClickUIOnMobile: 'Learn more'
  }
};

labels.ads.skipMessage: the skip message to show on player when a skippable ad is detected and the ad is in a state where it can be skipped. Default: 'Skip ad'

labels.ads.skipWaitingMessage: the skip message to show on player when a skippable ad is detected and the ad is in a state where it cannot be skipped. Default: 'Skip ad in'. This will be completed by the number of seconds remaining before the ad state changes to a state where it can be skipped.

labels.ads.textForClickUIOnMobile: on mobile devices the click-through URL for a linear ad is provided in a box located at the top right corner of the player. This setting set the text for this box. Default: 'Learn more'.


Autoplay support

As when using the Google IMA SDK, autoplay of pre-roll linear video ads on desktop and muted autoplay on mobile devices are supported. Refer to our documentation about autoplay support for more information.


Ad scheduling

Since Radiant Media Player 4.5.1 we support ad scheduling with rmp-vast through our ad scheduler.


Ad waterfalling

VAST redirect / VAST Wrapper have always been supported with rmp-vast since it was made publicly available. Since Radiant Media Player 4.5.2 we also support ad waterfalling through the adTagWaterfall setting with rmp-vast. See our ad waterfalling documentation for more information.


Ad Tag Variables & Macros

See the ad tag variables & macros documentation page.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License.