Skip to content

Commit

Permalink
Remove ix video bid code
Browse files Browse the repository at this point in the history
  • Loading branch information
shahin-rahbariasl committed Nov 4, 2021
1 parent 582bc01 commit a4e90e0
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 1,420 deletions.
25 changes: 22 additions & 3 deletions modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ const VIDEO_PARAMS_ALLOW_LIST = [
'playerSize', 'w', 'h'
];

// Possible values for bidResponse.seatBid[].bid[].mtype which indicates the type of the creative markup so that it can properly be associated with the right sub-object of the BidRequest.Imp.
const MEDIA_TYPES = {
Banner: 1,
Video: 2,
Audio: 3,
Native: 4
}

/**
* Transform valid bid request config object to banner impression object that will be sent to ad server.
*
Expand Down Expand Up @@ -262,9 +270,14 @@ function parseBid(rawBid, currency, bidRequest) {
bid.currency = currency;
bid.creativeId = rawBid.hasOwnProperty('crid') ? rawBid.crid : '-';

// in the event of a video
if (deepAccess(rawBid, 'ext.vasturl')) {
if (rawBid.mtype == MEDIA_TYPES.Video) {
bid.vastXml = rawBid.adm
} else if (rawBid.ext && rawBid.ext.vasturl) {
bid.vastUrl = rawBid.ext.vasturl
}

// in the event of a video
if ((rawBid.ext && rawBid.ext.vasturl) || rawBid.mtype == MEDIA_TYPES.Video) {
bid.width = bidRequest.video.w;
bid.height = bidRequest.video.h;
bid.mediaType = VIDEO;
Expand Down Expand Up @@ -950,7 +963,13 @@ function outstreamRenderer (bid) {
timeout: 3000
};

window.IXOutstreamPlayer(bid.vastUrl, bid.adUnitCode, config);
// IXOutstreamPlayer supports both vastUrl and vastXml, so we can pass either.
// Since vastUrl is going to be deprecated from exchange response, vastXml takes priority.
if (bid.vastXml) {
window.IXOutstreamPlayer(bid.vastXml, bid.adUnitCode, config);
} else {
window.IXOutstreamPlayer(bid.vastUrl, bid.adUnitCode, config);
}
});
}

Expand Down
Loading

0 comments on commit a4e90e0

Please sign in to comment.