diff --git a/integrationExamples/videoModule/adPlayerPro/bidRequestScheduling.html b/integrationExamples/videoModule/adPlayerPro/bidRequestScheduling.html index 7c73312c5c3..9c799d25058 100644 --- a/integrationExamples/videoModule/adPlayerPro/bidRequestScheduling.html +++ b/integrationExamples/videoModule/adPlayerPro/bidRequestScheduling.html @@ -13,7 +13,7 @@ var adUnits = [{ code: 'div-gpt-ad-51545-0', mediaTypes: { - video:{"context":"outstream"} + video: {context: 'outstream', playerSize: [640, 360]} }, video: { divId: 'player', // required to indicate which player is being used to render this ad unit. diff --git a/integrationExamples/videoModule/adPlayerPro/eventListeners.html b/integrationExamples/videoModule/adPlayerPro/eventListeners.html index 3c26ef42bee..8265d3c26a6 100644 --- a/integrationExamples/videoModule/adPlayerPro/eventListeners.html +++ b/integrationExamples/videoModule/adPlayerPro/eventListeners.html @@ -13,7 +13,7 @@ var adUnits = [{ code: 'div-gpt-ad-51545-0', mediaTypes: { - video:{"context":"outstream"} + video: {context: 'outstream', playerSize: [640, 360]} }, video: { divId: 'player', // required to indicate which player is being used to render this ad unit. diff --git a/modules/adplayerproVideoProvider.js b/modules/adplayerproVideoProvider.js index 826aee257ec..7f9b2ff3b69 100644 --- a/modules/adplayerproVideoProvider.js +++ b/modules/adplayerproVideoProvider.js @@ -2,6 +2,7 @@ import { API_FRAMEWORKS, PLACEMENT, PLAYBACK_METHODS, + PLCMT, PROTOCOLS, VIDEO_MIME_TYPE, VPAID_MIME_TYPE @@ -109,6 +110,7 @@ export function AdPlayerProProvider(config, adPlayerPro_, callbackStorage_, util API_FRAMEWORKS.VPAID_2_0, API_FRAMEWORKS.OMID_1_0 ], + plcmt: utils.getPlcmt(playerConfig) }; return video; @@ -347,6 +349,16 @@ export const utils = { return mute ? PLAYBACK_METHODS.AUTOPLAY_MUTED : PLAYBACK_METHODS.AUTOPLAY; } return PLAYBACK_METHODS.CLICK_TO_PLAY; + }, + + getPlcmt: function ({type, autoplay, muted, file}) { + type = type || "inStream"; + if (!file) { + //INTERSTITIAL: primary focus of the page and take up the majority of the viewport and cannot be scrolled out of view. + return type === "rewarded" || type === "inView" ? PLCMT.INTERSTITIAL : PLCMT.OUTSTREAM; + } + //INSTREAM must be set to “sound on” by default at player start + return type === "inStream" && (!muted || !autoplay) ? PLCMT.INSTREAM : PLCMT.ACCOMPANYING_CONTENT; } } diff --git a/test/spec/modules/videoModule/submodules/adplayerproVideoProvider_spec.js b/test/spec/modules/videoModule/submodules/adplayerproVideoProvider_spec.js index 1a792411497..32ed40d99f2 100644 --- a/test/spec/modules/videoModule/submodules/adplayerproVideoProvider_spec.js +++ b/test/spec/modules/videoModule/submodules/adplayerproVideoProvider_spec.js @@ -23,7 +23,7 @@ import sinon from 'sinon'; const {AdPlayerProProvider, utils} = require('modules/adplayerproVideoProvider.js'); const { - PROTOCOLS, API_FRAMEWORKS, VIDEO_MIME_TYPE, PLAYBACK_METHODS, VPAID_MIME_TYPE + PROTOCOLS, API_FRAMEWORKS, VIDEO_MIME_TYPE, PLAYBACK_METHODS, VPAID_MIME_TYPE, PLCMT } = require('libraries/video/constants/ortb.js'); function getPlayerMock() { @@ -66,6 +66,8 @@ function getUtilsMock() { getPlacement: function () { }, getPlaybackMethod: function () { + }, + getPlcmt: function () { } }; } @@ -218,10 +220,12 @@ describe('AdPlayerProProvider', function () { const test_media_type = VIDEO_MIME_TYPE.MP4; const test_placement = PLACEMENT.ARTICLE; const test_playback_method = PLAYBACK_METHODS.CLICK_TO_PLAY; + const test_plcmt = PLCMT.OUTSTREAM; utilsMock.getSupportedMediaTypes = () => [test_media_type]; utilsMock.getPlacement = () => test_placement; utilsMock.getPlaybackMethod = () => test_playback_method; + utilsMock.getPlcmt = () => test_plcmt; const provider = AdPlayerProProvider(config, null, null, utilsMock); provider.init(); @@ -242,7 +246,8 @@ describe('AdPlayerProProvider', function () { expect(video.playbackmethod).to.include(test_playback_method); expect(video.playbackend).to.equal(1); expect(video.api).to.have.length(2); - expect(video.api).to.include.members([API_FRAMEWORKS.VPAID_2_0, API_FRAMEWORKS.OMID_1_0]); // + expect(video.api).to.include.members([API_FRAMEWORKS.VPAID_2_0, API_FRAMEWORKS.OMID_1_0]); + expect(video.plcmt).to.equal(test_plcmt); }); }); @@ -409,6 +414,22 @@ describe('AdPlayerProProvider utils', function () { test(true, false, PLAYBACK_METHODS.AUTOPLAY); test(true, true, PLAYBACK_METHODS.AUTOPLAY_MUTED); }); + + it('getPlcmt', function () { + function test(type, autoplay, muted, file, expected) { + expect(utils.getPlcmt({type, autoplay, muted, file})).to.be.equal(expected); + } + + test("inStream", false, false, "f", PLCMT.INSTREAM); + test(undefined, false, false, "f", PLCMT.INSTREAM); + test("inStream", false, true, "f", PLCMT.INSTREAM); + test("inStream", true, false, "f", PLCMT.INSTREAM); + test("inStream", true, true, "f", PLCMT.ACCOMPANYING_CONTENT); + + test("rewarded", true, false, undefined, PLCMT.INTERSTITIAL); + test("inView", true, false, undefined, PLCMT.INTERSTITIAL); + test("InPage", true, false, undefined, PLCMT.OUTSTREAM); + }); }); describe('AdPlayerProProvider callbackStorageFactory', function () {