Skip to content

Commit

Permalink
Retain video-outstream compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewlane committed Sep 7, 2017
1 parent e7d2fea commit 0a024f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion modules/unrulyBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ function UnrulyAdapter() {
return
}

const videoMediaType = utils.deepAccess(bidRequestBids[0], 'mediaTypes.video')
const context = utils.deepAccess(bidRequestBids[0], 'mediaTypes.video.context')
if (context !== 'outstream') {
if (videoMediaType && context !== 'outstream') {
return
}

Expand Down
10 changes: 6 additions & 4 deletions src/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { videoAdapters } from './adaptermanager';
import { getBidRequest, deepAccess } from './utils';

const VIDEO_MEDIA_TYPE = 'video';
const INSTREAM = 'instream';
const OUTSTREAM = 'outstream';

/**
Expand All @@ -25,11 +24,14 @@ export const hasNonVideoBidder = adUnit =>
*/
export function isValidVideoBid(bid) {
const bidRequest = getBidRequest(bid.adId);
const context =
bidRequest && deepAccess(bidRequest, 'mediaTypes.video.context');

const videoMediaType =
bidRequest && deepAccess(bidRequest, 'mediaTypes.video');
const context = videoMediaType && deepAccess(videoMediaType, 'context');

// if context not defined assume default 'instream' for video bids
if (!bidRequest || !context || context === INSTREAM) {
// instream bids require a vast url or vast xml content
if (!bidRequest || (videoMediaType && context !== OUTSTREAM)) {
return !!(bid.vastUrl || bid.vastXml);
}

Expand Down

0 comments on commit 0a024f5

Please sign in to comment.