Skip to content

Commit

Permalink
fix(Ads): Disable interstitials when using AirPlay (#7479)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad authored Oct 23, 2024
1 parent 2b56dcd commit 2394ec2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ads/interstitial_ad_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ shaka.ads.InterstitialAdManager = class {
this.lastPlayedAd_ = null;

this.eventManager_.listen(this.baseVideo_, 'timeupdate', () => {
if (this.playingAd_) {
if (this.playingAd_ || this.basePlayer_.isRemotePlayback()) {
return;
}
const needPreRoll = this.lastTime_ == null || this.lastTime_ == 0;
Expand Down
13 changes: 13 additions & 0 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -8092,6 +8092,19 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
shaka.util.Error.Category.PLAYER,
shaka.util.Error.Code.LOAD_INTERRUPTED);
}

/**
* Indicate if we are using remote playback.
*
* @return {boolean}
* @export
*/
isRemotePlayback() {
if (!this.video_ || !this.video_.remote) {
return false;
}
return this.video_.remote.state != 'disconnected';
}
};

/**
Expand Down
1 change: 1 addition & 0 deletions test/cast/cast_utils_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('CastUtils', () => {
'getNonDefaultConfiguration',
'addFont',
'getFetchedPlaybackInfo',
'isRemotePlayback',

// Test helper methods (not @export'd)
'createDrmEngine',
Expand Down

0 comments on commit 2394ec2

Please sign in to comment.