Skip to content

Commit d0dd1ed

Browse files
DDeisjoeyparrish
authored andcommitted
feat(ads): allow adsResponse for making ad request (#2946)
Fixes #2892
1 parent ff16eb0 commit d0dd1ed

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Alvaro Velad Galvan <alvaro.velad@mirada.tv>
2121
Anthony Stansbridge <github@anthonystansbridge.co.uk>
2222
Bonnier Broadcasting <*@bonnierbroadcasting.com>
2323
Bryan Huh <bhh1988@gmail.com>
24+
Damien Deis <developer.deis@gmail.com>
2425
Esteban Dosztal <edosztal@gmail.com>
2526
Fadomire <fadomire@gmail.com>
2627
Google Inc. <*@google.com>

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Bryan Huh <bhh1988@gmail.com>
3434
Chad Assareh <assareh@google.com>
3535
Chris Fillmore <fillmore.chris@gmail.com>
3636
Costel Madalin Grecu <madalin.grecu@adswizz.com>
37+
Damien Deis <developer.deis@gmail.com>
3738
Donato Borrello <donato@jwplayer.com>
3839
Duc Pham <duc.pham@edgeware.tv>
3940
Esteban Dosztal <edosztal@gmail.com>

externs/ima.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,19 @@ google.ima.AdEvent.Type = {
227227

228228
/**
229229
* @typedef {{
230-
* adTagUrl: string,
230+
* adsResponse: (string|undefined),
231+
* adTagUrl: (string|undefined),
231232
* }}
232233
*
233234
* @description Request for the ad server
234-
* @property {string} adTagUrl
235+
* @property {string|undefined} adTagUrl
236+
* Specifies the ad tag url that is requested from the ad server.
237+
* This parameter is optional if adsReponse is given.
238+
* @property {string|undefined} adsResponse
239+
* Specifies a VAST 2.0 document to be used as the ads response instead of
240+
* making a request via an ad tag url. This can be useful for debugging
241+
* and other situations where a VAST response is already available.
242+
* This parameter is optional if adTagUrl is given.
235243
* @exportDoc
236244
*/
237245
google.ima.AdsRequest;

lib/ads/client_side_ad_manager.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ shaka.ads.ClientSideAdManager = class {
8484
* @param {!google.ima.AdsRequest} imaRequest
8585
*/
8686
requestAds(imaRequest) {
87-
goog.asserts.assert(imaRequest.adTagUrl.length,
88-
'The ad tag needs to be set up before requesting ads.');
87+
goog.asserts.assert(
88+
imaRequest.adTagUrl || imaRequest.adsResponse,
89+
'The ad tag needs to be set up before requesting ads, ' +
90+
'or adsResponse must be filled.');
8991
this.requestAdsStartTime_ = Date.now() / 1000;
9092
this.adsLoader_.requestAds(imaRequest);
9193
}

0 commit comments

Comments
 (0)