Skip to content

Commit

Permalink
feat(Ads): Fill loadTime stats in interstitials (#6817)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad authored Jun 13, 2024
1 parent bf15b24 commit 28d3c98
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/ads/interstitial_ad_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ shaka.ads.InterstitialAdManager = class {
oncePlayed = 0) {
goog.asserts.assert(this.video_, 'Must have video');

const startTime = Date.now();

if (!this.video_.parentElement && this.adContainer_) {
this.adContainer_.appendChild(this.video_);
}
Expand Down Expand Up @@ -538,6 +540,9 @@ shaka.ads.InterstitialAdManager = class {
} else {
await this.player_.load(interstitial.uri);
}
const loadTime = (Date.now() - startTime) / 1000;
this.onEvent_(new shaka.util.FakeEvent(shaka.ads.AdManager.ADS_LOADED,
(new Map()).set('loadTime', loadTime)));
if (this.usingBaseVideo_) {
this.baseVideo_.play();
}
Expand Down

0 comments on commit 28d3c98

Please sign in to comment.