Skip to content

Commit

Permalink
14.0.0
Browse files Browse the repository at this point in the history
rmp-vast v14 is a rewrite of rmp-vast with modern JavaScript using classes and getter/setter. Part of rmp-vast was already rewritten but this release completes the jobs.

Breaking changes are listed below:
- Removes forceUseContentPlayerForAds setting, forceUseContentPlayerForAdsOniOS setting, isUsingContentPlayerForAds API. These settings existed to support old platforms and iOS lack of support for Fullscreen API. Maintaining those settings was causing a lot of unwanted testing and work so we removed it to simplify the rmp-vast process of displaying video ads.
- Replaced getEnvironment with environment getter
- Replaced getAdPaused with adPaused getter
- Replaced setVolume with volume setter
- Replaced getVolume with volume getter
- Replaced setMute with muted setter
- Replaced getMute with muted getter
- Replaced getAdTagUrl with adTagUrl getter
- Replaced getAdMediaUrl with adMediaUrl getter
- Replaced getAdLinear with adLinear getter
- Replaced getAdSystem with adSystem getter
- Replaced getAdUniversalAdIds with adUniversalAdIds getter
- Replaced getAdContentType with adContentType getter
- Replaced getAdTitle with adTitle getter
- Replaced getAdDescription with adDescription getter
- Replaced getAdAdvertiser with adAdvertiser getter
- Replaced getAdPricing with adPricing getter
- Replaced getAdSurvey with adSurvey getter
- Replaced getAdAdServingId with adAdServingId getter
- Replaced getAdCategories with adCategories getter
- Replaced getAdBlockedAdCategories with adBlockedAdCategories getter
- Replaced getAdDuration with adDuration getter
- Replaced getAdCurrentTime with adCurrentTime getter
- Replaced getAdRemainingTime with adRemainingTime getter
- Replaced getAdOnStage with adOnStage getter
- Replaced getAdMediaWidth with adMediaWidth getter
- Replaced getAdMediaHeight with adMediaHeight getter
- Replaced getClickThroughUrl with clickThroughUrl getter
- Replaced getSkipTimeOffset with skipTimeOffset getter
- Replaced getIsSkippableAd with	isSkippableAd getter
- Replaced getContentPlayerCompleted  with contentPlayerCompleted getter
- Replaced setContentPlayerCompleted with contentPlayerCompleted setter
- Replaced getAdErrorMessage with adErrorMessage getter
- Replaced getAdVastErrorCode with adVastErrorCode getter
- Replaced getAdErrorType with adErrorType getter
- Replaced getIsUsingContentPlayerForAds with isUsingContentPlayerForAds getter
- Replaced getAdSkippableState with adSkippableState getter
- Replaced getVastPlayer with adPlayer getter
- Replaced getContentPlayer with contentPlayer getter
- Replaced getCompanionAdsRequiredAttribute with companionAdsRequiredAttribute getter
- Replaced getInitialized with initialized getter
- Replaced getAdPodInfo with adPodInfo getter
- Replaced getAdExpanded with adExpanded getter
- Replaced getVPAIDCompanionAds with vpaidCompanionAds getter
- Replaced textForClickUIOnMobile setting with textForInteractionUIOnMobile setting
- Replaced showControlsForVastPlayer setting with showControlsForAdPlayer setting
- Renamed dispatcher-event.js file to dispatcher.js file and DispatcherEvent class to Dispatcher class
- Renamed env.js file to environment.js file and ENV module to Environment class
- Renamed vast-player.js file to ad-player.js file and replaced VAST_PLAYER module with AdPlayer class
- Replaced CONTENT_PLAYER module with ContentPlayer class, ICONS module with Icons class, LINEAR module with LinearCreative class, NON_LINEAR module with NonLinearCreative class
- Replaced vpaid.js file with vpaid-player.js file and VPAID module with VpaidPlayer class
- Replaced tracking-events.js file with tracking.js file and TRACKING_EVENTS module with Tracking class
- Removed undocumented getFullscreen API

New features and enhancements
- Set SIMID support out of BETA (note we only support linear SIMID creatives for now)
- Reduced build size by ~ 5 %
- Updates to hls.js 1.5.6 for displaying HLS creatives
- Updates to Jasmine 5.1.2 for testing
- Updates devDependencies and dependencies to latest
- Adds simid-map test, outstream simid test, adBlockerSpec (requires manual testing)

Bug fixes
- Fixes an issue where linear creative with no <MediaFiles> could pass filtering and cause playback error
  • Loading branch information
radiantmediaplayer committed Feb 24, 2024
1 parent 102d27d commit dd85b1b
Show file tree
Hide file tree
Showing 181 changed files with 14,192 additions and 12,517 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ MIT License
rmp-vast is released under MIT License.
Terms are outlined below (from opensource.org)

Copyright (c) 2015-2022 Radiant Media Player | https://www.radiantmediaplayer.com
Copyright (c) 2015-2024 Radiant Media Player | https://www.radiantmediaplayer.com

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
117 changes: 56 additions & 61 deletions README.md

Large diffs are not rendered by default.

17 changes: 2 additions & 15 deletions app/dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,12 @@
<script>
var id = 'rmp';
const params = {
showControlsForVastPlayer: true,
enableSimid: true
showControlsForAdPlayer: true
};
var container = document.getElementById(id);
var ADTAG;
var ADTAG = 'https://www.radiantmediaplayer.com/vast/tags/inline-linear-1.xml';
/*ADTAG = 'https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/simid&description_url=https%3A%2F%2Fdevelopers.google.com%2Finteractive-media-ads&sz=640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=' + Date.now();*/

ADTAG = 'https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinearvpaid2js&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=' + Date.now()

//ADTAG = 'https://www.radiantmediaplayer.com/vast/tags/simid.xml';
//ADTAG = 'https://www.radiantmediaplayer.com/vast/tags/simid-error-interactive-creative-file.xml';
//ADTAG = 'https://www.radiantmediaplayer.com/vast/tags/simid-survey.xml';
//ADTAG = 'https://www.radiantmediaplayer.com/vast/tags/simid-selector.xml';
//ADTAG = 'https://www.radiantmediaplayer.com/vast/tags/simid-error-interactive-media-file.xml';
//ADTAG = 'https://www.radiantmediaplayer.com/vast/tags/simid-extender.xml';
//ADTAG = 'https://www.radiantmediaplayer.com/vast/tags/simid-map.xml';
//ADTAG = 'https://www.radiantmediaplayer.com/vast/tags/simid-non-linear.xml';
//ADTAG = 'https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/simid&description_url=https%3A%2F%2Fdevelopers.google.com%2Finteractive-media-ads&sz=640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=' + Date.now();


var rmpVast = new RmpVast(id, params);
rmpVast.loadAds(ADTAG);
Expand Down
2 changes: 1 addition & 1 deletion app/hls.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
autoplay: false,
useHlsJS: true,
debugHlsJS: false,
showControlsForVastPlayer: true
showControlsForAdPlayer: true
};
var rmpVast = new RmpVast(id, params);
rmpVast.loadAds(ADTAG);
Expand Down
110 changes: 54 additions & 56 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ <h4>Open-source client-side JavaScript solution to load, parse and display VAST
<h4>Implementation example</h4>
<p><a href="https://github.com/radiantmediaplayer/rmp-vast">See source on GitHub</a> - a <a
href="https://www.radiantmediaplayer.com">Radiant Media Player</a> project</p>
<p>NEW: SIMID support <sup>BETA</sup> - <a href="https://github.com/radiantmediaplayer/rmp-vast/issues">feedback
is welcome!</a></p>
<div class="rmp-container" id="rmp">
<div class="rmp-content">
<video class="rmp-video" src="https://www.rmp-streaming.com/media/big-buck-bunny-360p.mp4"
Expand All @@ -49,121 +47,121 @@ <h4>Methods (Click "play" to start player)</h4>
<button type="button" class="btn btn-outline-primary" id="loadAds">loadAds(newAdTagUrl)</button>
</div>
<div class="mt-2">
<button type="button" class="btn btn-outline-primary" id="mute">setMute(true)</button>
<button type="button" class="btn btn-outline-primary" id="unmute">setMute(false)</button>
<button type="button" class="btn btn-outline-primary" id="volume13">setVolume(0.33)</button>
<button type="button" class="btn btn-outline-primary" id="volume23">setVolume(0.66)</button>
<button type="button" class="btn btn-outline-primary" id="volume33">setVolume(1)</button>
<button type="button" class="btn btn-outline-primary" id="mute">muted = true</button>
<button type="button" class="btn btn-outline-primary" id="unmute">muted = false</button>
<button type="button" class="btn btn-outline-primary" id="volume13">volume = 0.33</button>
<button type="button" class="btn btn-outline-primary" id="volume23">volume = 0.66</button>
<button type="button" class="btn btn-outline-primary" id="volume33">volume = 1</button>
</div>
<div class="mt-2">
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdPaused">getAdPaused</button><span
id="getAdPausedResult"></span>
<button type="button" class="btn btn-outline-primary" id="adPaused">adPaused</button><span
id="adPausedResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getVolume">getVolume</button><span
id="getVolumeResult"></span>
<button type="button" class="btn btn-outline-primary" id="volume">volume</button><span
id="volumeResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getMute">getMute</button><span
id="getMuteResult"></span>
<button type="button" class="btn btn-outline-primary" id="muted">muted</button><span
id="mutedResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdTagUrl">getAdTagUrl</button><span
id="getAdTagUrlResult"></span>
<button type="button" class="btn btn-outline-primary" id="adTagUrl">adTagUrl</button><span
id="adTagUrlResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdMediaUrl">getAdMediaUrl</button><span
id="getAdMediaUrlResult"></span>
<button type="button" class="btn btn-outline-primary" id="adMediaUrl">adMediaUrl</button><span
id="adMediaUrlResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdLinear">getAdLinear</button><span
id="getAdLinearResult"></span>
<button type="button" class="btn btn-outline-primary" id="adLinear">adLinear</button><span
id="adLinearResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdSystem">getAdSystem</button><span
id="getAdSystemResult"></span>
<button type="button" class="btn btn-outline-primary" id="adSystem">adSystem</button><span
id="adSystemResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary"
id="getAdUniversalAdIds">getAdUniversalAdIds</button><span id="getAdUniversalAdIdsResult"></span>
id="adUniversalAdIds">adUniversalAdIds</button><span id="adUniversalAdIdsResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdContentType">getAdContentType</button><span
id="getAdContentTypeResult"></span>
<button type="button" class="btn btn-outline-primary" id="adContentType">adContentType</button><span
id="adContentTypeResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdTitle">getAdTitle</button><span
id="getAdTitleResult"></span>
<button type="button" class="btn btn-outline-primary" id="adTitle">adTitle</button><span
id="adTitleResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdDescription">getAdDescription</button><span
id="getAdDescriptionResult"></span>
<button type="button" class="btn btn-outline-primary" id="adDescription">adDescription</button><span
id="adDescriptionResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdAdvertiser">getAdAdvertiser</button><span
id="getAdAdvertiserResult"></span>
<button type="button" class="btn btn-outline-primary" id="adAdvertiser">adAdvertiser</button><span
id="adAdvertiserResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdPricing">getAdPricing</button><span
id="getAdPricingResult"></span>
<button type="button" class="btn btn-outline-primary" id="adPricing">adPricing</button><span
id="adPricingResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdSurvey">getAdSurvey</button><span
id="getAdSurveyResult"></span>
<button type="button" class="btn btn-outline-primary" id="adSurvey">adSurvey</button><span
id="adSurveyResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdAdServingId">getAdAdServingId</button><span
id="getAdAdServingIdResult"></span>
<button type="button" class="btn btn-outline-primary" id="adAdServingId">adAdServingId</button><span
id="adAdServingIdResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdCategories">getAdCategories</button><span
id="getAdCategoriesResult"></span>
<button type="button" class="btn btn-outline-primary" id="adCategories">adCategories</button><span
id="adCategoriesResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary"
id="getAdBlockedAdCategories">getAdBlockedAdCategories</button><span
id="getAdBlockedAdCategoriesResult"></span>
id="adBlockedAdCategories">adBlockedAdCategories</button><span
id="adBlockedAdCategoriesResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdDuration">getAdDuration</button><span
id="getAdDurationResult"></span>
<button type="button" class="btn btn-outline-primary" id="adDuration">adDuration</button><span
id="adDurationResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdCurrentTime">getAdCurrentTime</button><span
id="getAdCurrentTimeResult"></span>
<button type="button" class="btn btn-outline-primary" id="adCurrentTime">adCurrentTime</button><span
id="adCurrentTimeResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary"
id="getAdRemainingTime">getAdRemainingTime</button><span id="getAdRemainingTimeResult"></span>
id="adRemainingTime">adRemainingTime</button><span id="adRemainingTimeResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdOnStage">getAdOnStage</button><span
id="getAdOnStageResult"></span>
<button type="button" class="btn btn-outline-primary" id="adOnStage">adOnStage</button><span
id="adOnStageResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdMediaWidth">getAdMediaWidth</button><span
id="getAdMediaWidthResult"></span>
<button type="button" class="btn btn-outline-primary" id="adMediaWidth">adMediaWidth</button><span
id="adMediaWidthResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getAdMediaHeight">getAdMediaHeight</button><span
id="getAdMediaHeightResult"></span>
<button type="button" class="btn btn-outline-primary" id="adMediaHeight">adMediaHeight</button><span
id="adMediaHeightResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary"
id="getClickThroughUrl">getClickThroughUrl</button><span id="getClickThroughUrlResult"></span>
id="clickThroughUrl">clickThroughUrl</button><span id="clickThroughUrlResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary"
id="getSkipTimeOffset">getSkipTimeOffset</button><span id="getSkipTimeOffsetResult"></span>
id="skipTimeOffset">skipTimeOffset</button><span id="skipTimeOffsetResult"></span>
</div>
<div class="mt-1">
<button type="button" class="btn btn-outline-primary" id="getIsSkippableAd">getIsSkippableAd</button><span
id="getIsSkippableAdResult"></span>
<button type="button" class="btn btn-outline-primary" id="isSkippableAd">isSkippableAd</button><span
id="isSkippableAdResult"></span>
</div>
<div class="mt-1 mb-5">
<button type="button" class="btn btn-outline-primary"
id="getAdSkippableState">getAdSkippableState</button><span id="getAdSkippableStateResult"></span>
id="adSkippableState">adSkippableState</button><span id="adSkippableStateResult"></span>
</div>
</div>
</div>
Expand Down
86 changes: 43 additions & 43 deletions app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ const _exitFullscreen = function (video) {

const _setFullscreen = function (fs) {
if (typeof fs === 'boolean') {
const contentPlayer = rmpVast.getContentPlayer();
const vastPlayer = rmpVast.getVastPlayer();
const contentPlayer = rmpVast.contentPlayer;
const adPlayer = rmpVast.adPlayer;
if (isInFullscreen && !fs) {
if (rmpVast.getAdOnStage() && rmpVast.getAdLinear()) {
_exitFullscreen(vastPlayer);
if (rmpVast.adOnStage && rmpVast.adLinear) {
_exitFullscreen(adPlayer);
} else {
_exitFullscreen(contentPlayer);
}
} else if (!isInFullscreen && fs) {
if (rmpVast.getAdOnStage() && rmpVast.getAdLinear()) {
_requestFullscreen(container, vastPlayer);
if (rmpVast.adOnStage && rmpVast.adLinear) {
_requestFullscreen(container, adPlayer);
} else {
_requestFullscreen(container, contentPlayer);
}
Expand Down Expand Up @@ -138,10 +138,10 @@ const params = {
labels: {
skipMessage: 'Skip ad',
closeAd: 'Close ad',
textForClickUIOnMobile: 'Learn more'
textForInteractionUIOnMobile: 'Learn more'
},
outstream: false,
showControlsForVastPlayer: true,
showControlsForAdPlayer: true,
enableSimid: true,
enableVpaid: true,
vpaidSettings: {
Expand Down Expand Up @@ -210,62 +210,62 @@ const _wireUI = function () {

const mute = document.getElementById('mute');
mute.addEventListener('click', function () {
rmpVast.setMute(true);
rmpVast.muted = true;
});

const unmute = document.getElementById('unmute');
unmute.addEventListener('click', function () {
rmpVast.setMute(false);
rmpVast.muted = false;
});

const volume13 = document.getElementById('volume13');
volume13.addEventListener('click', function () {
rmpVast.setVolume(0.33);
rmpVast.volume = 0.33;
});

const volume23 = document.getElementById('volume23');
volume23.addEventListener('click', function () {
rmpVast.setVolume(0.66);
rmpVast.volume = 0.66;
});

const volume33 = document.getElementById('volume33');
volume33.addEventListener('click', function () {
rmpVast.setVolume(1);
rmpVast.volume = 1;
});

const getters = [
'getAdPaused',
'getVolume',
'getMute',
'getAdTagUrl',
'getAdMediaUrl',
'getAdLinear',
'getAdSystem',
'getAdUniversalAdIds',
'getAdContentType',
'getAdTitle',
'getAdDescription',
'getAdAdvertiser',
'getAdPricing',
'getAdSurvey',
'getAdAdServingId',
'getAdCategories',
'getAdBlockedAdCategories',
'getAdDuration',
'getAdCurrentTime',
'getAdRemainingTime',
'getAdOnStage',
'getAdMediaWidth',
'getAdMediaHeight',
'getClickThroughUrl',
'getSkipTimeOffset',
'getIsSkippableAd',
'getAdSkippableState'
'adPaused',
'volume',
'muted',
'adTagUrl',
'adMediaUrl',
'adLinear',
'adSystem',
'adUniversalAdIds',
'adContentType',
'adTitle',
'adDescription',
'adAdvertiser',
'adPricing',
'adSurvey',
'adAdServingId',
'adCategories',
'adBlockedAdCategories',
'adDuration',
'adCurrentTime',
'adRemainingTime',
'adOnStage',
'adMediaWidth',
'adMediaHeight',
'clickThroughUrl',
'skipTimeOffset',
'isSkippableAd',
'adSkippableState'
];
const _bindResult = function (index) {
if (getters[index]) {
const result = document.getElementById(getters[index] + 'Result');
let value = rmpVast[getters[index]]();
let value = rmpVast[getters[index]];
if (value === null) {
value = 'null';
} else if (typeof value === 'object') {
Expand Down Expand Up @@ -325,8 +325,8 @@ const _wireUI = function () {
console.log(data);
eventLogs.insertAdjacentHTML('afterbegin', '<p>' + data + '</p>');
if (event.type === 'aderror') {
const errorMessage = rmpVast.getAdErrorMessage();
const errorCode = rmpVast.getAdVastErrorCode();
const errorMessage = rmpVast.adErrorMessage;
const errorCode = rmpVast.adVastErrorCode;
const errorLog = errorCode + ' - ' + errorMessage;
console.log(errorLog);
eventLogs.insertAdjacentHTML('afterbegin', '<p>' + errorLog + '</p>');
Expand Down
2 changes: 1 addition & 1 deletion app/omid.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
omidAutoplay: true,
omidRunValidationScript: true,
omidUnderEvaluation: true,
showControlsForVastPlayer: true
showControlsForAdPlayer: true
};
var rmpVast = new RmpVast(id, params);
rmpVast.loadAds(ADTAG);
Expand Down
Loading

0 comments on commit dd85b1b

Please sign in to comment.