mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-15 16:06:41 +03:00
fix(Ads): Fix duplicate Ads when playing interstitials through native HLS player (#7527)
This commit is contained in:
committed by
GitHub
parent
fb1ce42adb
commit
075713f0e0
@@ -367,7 +367,7 @@ shaka.ads.InterstitialAdManager = class {
|
||||
}
|
||||
let cuepointsChanged = false;
|
||||
for (const interstitial of interstitials) {
|
||||
const interstitialId = JSON.stringify(interstitial);
|
||||
const interstitialId = interstitial.id || JSON.stringify(interstitial);
|
||||
if (this.interstitialIds_.has(interstitialId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -777,6 +777,16 @@ shaka.ads.InterstitialAdManager = class {
|
||||
if (hlsInterstitialId) {
|
||||
id = /** @type {string} */(hlsInterstitialId.data);
|
||||
}
|
||||
const startTime = id == null ?
|
||||
Math.floor(hlsInterstitial.startTime * 10) / 10:
|
||||
hlsInterstitial.startTime;
|
||||
let endTime = hlsInterstitial.endTime;
|
||||
if (hlsInterstitial.endTime && hlsInterstitial.endTime != Infinity &&
|
||||
typeof(hlsInterstitial.endTime) == 'number') {
|
||||
endTime = id == null ?
|
||||
Math.floor(hlsInterstitial.endTime * 10) / 10:
|
||||
hlsInterstitial.endTime;
|
||||
}
|
||||
const restrict = hlsInterstitial.values.find((v) => v.key == 'X-RESTRICT');
|
||||
let isSkippable = true;
|
||||
let canJump = true;
|
||||
@@ -851,8 +861,8 @@ shaka.ads.InterstitialAdManager = class {
|
||||
}
|
||||
interstitialsAd.push({
|
||||
id,
|
||||
startTime: hlsInterstitial.startTime,
|
||||
endTime: hlsInterstitial.endTime,
|
||||
startTime,
|
||||
endTime,
|
||||
uri,
|
||||
isSkippable,
|
||||
skipOffset,
|
||||
@@ -901,8 +911,8 @@ shaka.ads.InterstitialAdManager = class {
|
||||
if (asset['URI']) {
|
||||
interstitialsAd.push({
|
||||
id,
|
||||
startTime: hlsInterstitial.startTime,
|
||||
endTime: hlsInterstitial.endTime,
|
||||
startTime,
|
||||
endTime,
|
||||
uri: asset['URI'],
|
||||
isSkippable,
|
||||
skipOffset,
|
||||
|
||||
Reference in New Issue
Block a user