Skip to content

Commit

Permalink
use Ad from AdBeginEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
wjoosen committed Aug 22, 2024
1 parent 84afa8d commit e3f6673
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nielsen/src/integration/NielsenHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export class NielsenHandler {
};

private onAdBegin = ({ ad }: AdEvent<'adbegin'>) => {
const currentAd = this.player.ads!.currentAds.filter((ad: Ad) => ad.type === 'linear'); // TODO check why we chose to not use the ad from the event payload
if (ad.type !== 'linear') return;
const { adBreak } = ad;
const { timeOffset } = adBreak;
const offset = this.player.ads?.dai?.contentTimeForStreamTime(timeOffset) ?? timeOffset;
Expand All @@ -249,7 +249,7 @@ export class NielsenHandler {
this.nSdkInstance.ggPM('loadMetadata', dtvrAdMetadata);
}
if (this.dcrEnabled) {
const dcrAdMetadata = buildDCRAdMetadata(currentAd[0], this.country, this.duration);
const dcrAdMetadata = buildDCRAdMetadata(ad, this.country, this.duration);
this.nSdkInstance.ggPM('loadMetadata', dcrAdMetadata);
}
};
Expand Down

0 comments on commit e3f6673

Please sign in to comment.