-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for video stream context #1483
Conversation
fa34232
to
63f5c19
Compare
b9df58c
to
3d89da0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthewlane left some comments.
src/utils.js
Outdated
* @param{MediaTypes} mediaTypes mediaTypes parameter to validate | ||
* @returns{boolean} If object is valie | ||
*/ | ||
export function mediaTypesValid(mediaTypes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all functions returning boolean, naming should start with is
or has
. I was going through it over here https://google.github.io/styleguide/jsguide.html#naming-method-names.
So this function can be renamed as hasValidMediaType
or isValidMediaType
src/video.js
Outdated
/* | ||
* Validate that the assets required for video context are present on the bid | ||
*/ | ||
export function videoBidIsValid(bid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment made above for function mediaTypesValid
applies here too.
Also add missing JSDoc for param and return value and unit test for this function
src/video.js
Outdated
|
||
// if context not defined assume default 'instream' for video bids | ||
if (!bidRequest || !context || context === INSTREAM) { | ||
return !!(bid.vastUrl || bid.vastPayload); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are removingbid.descriptionUrl
when prebid-cache is live or stable.
So on that note, will this also include bid.descriptionUrl
? Not very sure though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't, just bid.vastUrl
or a vast payload is required. vastPayload
was renamed vastXml
, will push an updated to fix that here
111d829
to
7774e78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
0a024f5
to
a2854c8
Compare
a2854c8
to
0c8c9f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @matthewlane nice work! Few minor things and we can merge.
src/adaptermanager.js
Outdated
if (utils.isValidMediaTypes(adUnit.mediaTypes)) { | ||
bid = Object.assign({}, bid, { mediaTypes: adUnit.mediaTypes }); | ||
} else { | ||
utils.logError(`mediaTypes is not correctly configured`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add the adUnit.code here so they know which adUnit failed validation?
test/spec/video_spec.js
Outdated
|
||
expect(valid).to.be(true); | ||
|
||
utils.getBidRequest.restore(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these calls are better in a afterEach
block so failures don't cascade.
…built * 'master' of https://github.com/prebid/Prebid.js: (46 commits) Serverbid alias (prebid#1560) Add user sync to process for approving adapter PRs (prebid#1457) fix travis build (prebid#1595) Rubicon project improvement/user sync (prebid#1549) Adding Orbitsoft adapter (prebid#1378) Fix renderer test for new validation rule (prebid#1592) Allow SET_TARGETING to be used in AnalyticsAdapter (prebid#1577) Add support for video stream context (prebid#1483) Invalidate bid if matching bid request not found (prebid#1575) allow adapters to set default adserverTargeting for specific bid (prebid#1568) Custom granularity precision should honor 0 if it is passed in closes prebid#1479 (prebid#1591) BaseAdapter for the Prebid 0.x -> 1.x transition (prebid#1494) Add a version to the Criteo adapter (prebid#1573) Allow bundling from node.js or with new gulp task bundle-to-stdout (prebid#1570) Add url.parse option to not decode the whole URL (prebid#1480) Tremor Video Bid Adapter (prebid#1552) Yieldmo bid adapter (prebid#1415) Switch `gulp docs` to build its output using documentation.js (prebid#1545) Increment pre version Prebid 0.28.0 Release ...
* Add support for video stream context * Define adapter as supporting video * Use mediaTypes param to specify context * Use utils.deepAccess * Check for outstream bids * Add JSDoc and validation * Rename functions and add unit test * Update property name * Update stubs to new sinon stub syntax * Only check context when mediaTypes.video was defined * Retain video-outstream compatibility * Revert to Sinon 1 syntax * Server and bid response ad type for any stream type is always 'video' * Update to address code review
* tag '0.29.0' of https://github.com/prebid/Prebid.js: (29 commits) Prebid 0.29.0 Release Fix for not syncing bidders. (prebid#1598) fix amp example pages (prebid#1597) closes prebid#1298 (prebid#1583) Fixed the broken tests. (prebid#1602) Rubicon Bidder Factory (prebid#1587) Trustx adapter (prebid#1488) Add nurl to markup (prebid#1601) Pass bidRequest to createBid (prebid#1600) Add Kumma adapter (prebid#1512) Serverbid alias (prebid#1560) Add user sync to process for approving adapter PRs (prebid#1457) fix travis build (prebid#1595) Rubicon project improvement/user sync (prebid#1549) Adding Orbitsoft adapter (prebid#1378) Fix renderer test for new validation rule (prebid#1592) Allow SET_TARGETING to be used in AnalyticsAdapter (prebid#1577) Add support for video stream context (prebid#1483) Invalidate bid if matching bid request not found (prebid#1575) allow adapters to set default adserverTargeting for specific bid (prebid#1568) ...
* Add support for video stream context * Define adapter as supporting video * Use mediaTypes param to specify context * Use utils.deepAccess * Check for outstream bids * Add JSDoc and validation * Rename functions and add unit test * Update property name * Update stubs to new sinon stub syntax * Only check context when mediaTypes.video was defined * Retain video-outstream compatibility * Revert to Sinon 1 syntax * Server and bid response ad type for any stream type is always 'video' * Update to address code review
Type of change
Description of change
This pull request adds support for video-enabled adapters to participate on both instream and outstream impressions by removing the
video-outstream
mediaType and introducing a new ad unit parametermediaTypes
that can be used to configurevideo
ad units to eitherinstream
(default) oroutstream
. No changes are required for adapters that support the currentvideo
mediaType, though themediaTypes
parameter of an adUnit, which may contain a stream context, is now given to adapters in thecallBids
parameter, and adapters may use this to target instream and outstream impressions differently if they wish.In the case of instream context, bid response objects must contain a
vastUrl
property (this is an existing requirement and not introduced by this PR). Outstream bid response objects must have an associated renderer, either directly on the bid or one defined on the ad unit with therenderer
ad unit parameter.Example AdUnits with Video Context
Other informatin
@unrulydevelopers unruly adapter is updated by this PR to check for outstream context, please feel free to review and make updates or suggestions to this change