Repository navigation
Skip mediation banner refresh while a Prebid video is playing - #1020
Open
mdanylov-sigma wants to merge 1 commit into
Open
mdanylov-sigma wants to merge 1 commit into
mdanylov-sigma wants to merge 1 commit into
Conversation
3 tasks done
MediationBannerAdUnit's refresh listener only checked the mediation SDK's visibility and the screen state, so a refresh tick could tear down a Prebid video creative mid playback. BannerView already skips the tick in that case. Mirror what iOS does in MediationBannerAdUnit.swift: read the playback state off whatever is actually rendered, rather than off the auction's outcome. PrebidMediationDelegate gains getAdView(), the mediation SDK's ad view is walked for the MediationBannerView the adapter rendered into, and the tick is skipped while that view reports a playing video. The gate therefore clears on its own when playback finishes or when another demand partner wins. getAdView() is a default method returning null, so existing delegates - the interstitial and rewarded utils, and any publisher's own implementation - keep compiling and simply opt out of the gate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
mdanylov-sigma
force-pushed
the
feature/1017-mediation-video-refresh-gate
branch
from
November 30, 2026 17:13
2034731 to
4020cab
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1017.
Problem
BannerViewskips a refresh tick while a Prebid video creative is playing, so the creative is never torn down mid playback.MediationBannerAdUnithas no equivalent gate — its refresh listener only checksmediationDelegate.canPerformRefresh()andscreenStateReceiver.isScreenOn(). A multiformat mediation banner with a refresh interval shorter than its video creative gets cut off.#1010 left this out on the grounds that a mediation ad unit is not told whether the Prebid bid won in the primary ad server. That is true, but it is not what the gate needs to know.
Approach
Mirrors iOS
MediationBannerAdUnit.swift, which reads the playback state off whatever is actually rendered rather than off the auction's outcome:PrebidMediationDelegategainsgetAdView(), the counterpart of iOS'sPrebidMediationDelegate.getAdView().MediationBannerView— the container both adapters render into — exposesisVideoPlaying(), same shape asDisplayView.isVideoPlaying()from Multiformat banner ad unit in the rendering and mediation APIs #1010.MediationBannerAdUnit.isVideoPlaying()walks the mediation SDK's ad view for that container and reads the flag;initBidLoader()'s refresh listener skips the tick when it is true. As on iOS, the timer is only skipped, not cancelled, so refreshing resumes on its own once playback finishes.Because the gate is driven by "is a Prebid creative currently playing", it reports false when another demand partner won the mediation auction, with no need for the ad unit to learn who won.
getAdView()is adefaultmethod returningnull, matching howonAdExpiredandgetRewardwere added to their interfaces. The interstitial and rewarded utils, and any publisher's ownPrebidMediationDelegate, keep compiling and simply opt out of the gate — thesetAdUnitFormatsjavadoc now says so, and points those publishers atstopRefresh()/resumeRefresh().Changes
PrebidMediationDelegatedefault View getAdView()returningnullAdMobMediationBannerUtils,MaxMediationBannerUtilsMediationBannerViewisVideoPlaying()MediationBannerAdUnitisVideoPlaying()gate in the refresh listener; javadocViewsfindFirstDescendantOfType(), the counterpart of iOS'sUIView.firstDescendant(of:)Testing
MediationBannerAdUnitTestcovers the tick being skipped during playback, allowed after playback, allowed afteronAdFailed()even while video reports playing, andisVideoPlaying()returning false with no Prebid view in the hierarchy, no ad view, and a delegate that does not implementgetAdView(). NewViewsTestcovers the hierarchy walk.:PrebidMobile-core:testDebugUnitTestpasses exceptMraidInternalBrowserActionTest > handleInternalBrowserActionFollowUrlSuccessAndIsMraid_StartActionViewActivity, which fails onmasteras well and is unrelated to this change.🤖 Generated with Claude Code