Skip to content

Commit

Permalink
Publishing latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawn Busolits committed Dec 8, 2015
1 parent 8d69e77 commit 65fce99
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
9 changes: 4 additions & 5 deletions advanced/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ var Application = function() {
this.setVideoEndedCallbackEnabled(true);
};

Application.prototype.SAMPLE_AD_TAG_ = 'http://pubads.g.doubleclick.net/' +
'gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&' +
'ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&' +
Application.prototype.SAMPLE_AD_TAG_ = 'https://pubads.g.doubleclick.net/' +
'gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&' +
'ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&' +
'unviewed_position_start=1&' +
'cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&cmsid=496&' +
'vid=short_onecue&correlator=';
'cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator=';

Application.prototype.setVideoEndedCallbackEnabled = function(enable) {
if (enable) {
Expand Down
25 changes: 17 additions & 8 deletions playlist/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,19 @@ var Application = function() {
false);
}

this.initialUserActionHappened_ = false;
this.playing_ = false;
this.adsActive_ = false;
this.adsDone_ = false;
this.fullscreen = false;

this.videoPlayer_ = new VideoPlayer();
this.ads_ = new Ads(this, this.videoPlayer_);
this.adTagUrl_ = 'http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&' +
'iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&' +
'impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&' +
'cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&cmsid=496&' +
'vid=short_onecue&correlator=';
this.adTagUrl_ = 'https://pubads.g.doubleclick.net/' +
'gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&' +
'ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&' +
'unviewed_position_start=1&' +
'cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator=';

this.videoEndedCallback_ = this.bind_(this, this.onContentEnded_);
this.setVideoEndedCallbackEnabled(true);
Expand Down Expand Up @@ -112,9 +113,12 @@ Application.prototype.bind_ = function(thisObj, fn) {
Application.prototype.onClick_ = function() {
if (!this.adsDone_) {

// The user clicked/tapped - inform the ads controller that this code
// is being run in a user action thread.
this.ads_.initialUserAction();
if (!this.initialUserActionHappened_) {
// The user clicked/tapped - inform the ads controller that this code
// is being run in a user action thread.
this.ads_.initialUserAction();
this.initialUserActionHappened_ = true;
}
// At the same time, initialize the content player as well.
// When content is loaded, we'll issue the ad request to prevent it
// from interfering with the initialization. See
Expand Down Expand Up @@ -245,6 +249,11 @@ Application.prototype.onPlaylistItemClick_ = function(event) {
if (!this.ads_.linearAdPlaying) {
this.ads_.destroyAdsManager();
this.ads_.contentCompleted();
if (!this.initialUserActionHappened_) {
this.ads_.initialUserAction();
this.initialUserActionHappened_ = true;
}
this.adsDone_ = true;
this.videoPlayer_.setContentVideoIndex(event.target.id);
this.videoPlayer_.preloadContent(this.bind_(this, this.loadAds_));
}
Expand Down
10 changes: 4 additions & 6 deletions simple/ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ function requestAds() {

// Request video ads.
var adsRequest = new google.ima.AdsRequest();
adsRequest.adTagUrl =
'http://pubads.g.doubleclick.net/gampad/ads?sz=400x300&' +
'iu=%2F6062%2Fiab_vast_samples&ciu_szs=300x250%2C728x90&gdfp_req=1&' +
'env=vp&output=vast&unviewed_position_start=1&url=' +
'[referrer_url]&correlator=[timestamp]&cust_params=iab_vast_samples' +
'%3Dlinear';
adsRequest.adTagUrl = 'https://pubads.g.doubleclick.net/gampad/ads?' +
'sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&' +
'impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&' +
'cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator=';

// Specify the linear and nonlinear slot sizes. This helps the SDK to
// select the correct creative if multiple are returned.
Expand Down

0 comments on commit 65fce99

Please sign in to comment.