Repository navigation
feat(rendering): add BannerView.setVideoParameters / getVideoParameters - #1000
Conversation
|
Thanks for the thorough review — both points were spot-on. Pushed a follow-up commit taking option (a).
if (adConfiguration.isOriginalAdUnit() || adConfiguration.getVideoParameters() != null)It's guarded on Non-interstitial Happy to add tests or adjust the approach (e.g. a dedicated non-original branch instead of the |
sw2 makes BasicParameterBuilder honor VideoParameters on the rendering path (same branch as the original API), so the two *_full tests now assert the explicit params (placement 2, durations, mimes, protocols, ...) instead of the rendering defaults they were written for. Mirrors the upstream fix in prebid#1000 (9c1b751).
|
@mdanylov-sigma @YuriyVelichkoPI friendly bump. The follow-up from Sep 2 addressed the earlier feedback, and the PR has no conflicts with |
mdanylov-sigma
left a comment
There was a problem hiding this comment.
Thanks for the update, and sorry for the slow turnaround. Since #1010 landed, two things remain in this PR: the BannerView.setVideoParameters setter and the setVideoImpValues gate. The setter is worth having. The builder change overlaps #1021 (mine, closes #1018), which fixes the same gap differently. The two PRs conflict in BasicParameterBuilder and BasicParameterBuilderTest.
The difference matters for the request. With this PR, once VideoParameters are set, no rendering default applies, so every field the publisher leaves out is missing from the imp. iOS (PrebidParameterBuilder.swift) sets the rendering defaults first and then overrides only the fields the publisher set, and #1021 does the same. I built the request for a BANNER + VIDEO BannerView config on both branches:
VideoParameters |
this PR | #1021 / iOS |
|---|---|---|
| not set | defaults (unchanged) | defaults (unchanged) |
mimes video/mp4, placement InBanner, maxduration 30 |
protocols, linearity, playbackend are gone |
defaults kept, the 3 set fields override them |
| empty mimes list, placement InBanner | no mimes at all |
default mimes kept |
Prebid Server rejects a video imp without mimes, so on a multiformat imp the banner demand is lost too. Note that on iOS videoParameters starts as VideoParameters(mimes: []), so an empty list is a natural thing to port.
Suggestion: drop the BasicParameterBuilder change and the test updates here, keep the BannerView setter (plus a getter), and rebase onto master once #1021 merges. The setter then becomes the one-liner #1018 anticipated, and the "matches iOS" note in the description holds.
CI never ran on this branch: all six "Pull Request Checks" runs ended as failure with zero jobs. I ran BasicParameterBuilderTest (56 tests) and BannerViewTest (59) locally on this branch merged with current master, and both pass.
Nit: the title still says multiformat; since #1010 the PR is about BannerView.setVideoParameters.
| // only when they're explicitly set is guarded: rendering units that never | ||
| // call setVideoParameters keep the original default branch. isOriginalAdUnit | ||
| // is intentionally not flipped — it drives more than video imp building. | ||
| if (adConfiguration.isOriginalAdUnit() || adConfiguration.getVideoParameters() != null) { |
There was a problem hiding this comment.
This is the gap tracked in #1018, which #1021 closes with the iOS semantics: defaults first, then each field the publisher set wins. With || here, a set VideoParameters switches the rendering imp to the original-API branch, so protocols, linearity and playbackend disappear unless the publisher sets them, and an empty mimes list sends no mimes at all. Could this hunk and the comment above it be dropped in favor of #1021?
Separately, the nine-line comment describes the old bug. That history fits the commit message better than the code.
There was a problem hiding this comment.
Dropped, along with the comment. The history is in the commit message now; #1021 owns the builder fix.
| * @param videoParameters the video parameters to apply to the request, or null to use the | ||
| * rendering defaults | ||
| */ | ||
| public void setVideoParameters(@Nullable VideoParameters videoParameters) { |
There was a problem hiding this comment.
Could this get a getVideoParameters() too? The original API's BannerBaseAdUnit has the get/set pair, BannerView already pairs setAdUnitFormats with getAdUnitFormats, and on iOS BannerView.videoParameters is a get/set property.
There was a problem hiding this comment.
Added getVideoParameters(), delegating to adUnitConfig.
| * multiformat {@link BannerView} (see {@link #setAdUnitFormats(EnumSet)}). | ||
| * <p> | ||
| * Once video parameters are set, the request builder uses them instead of the rendering | ||
| * defaults. Defaults such as {@code playbackend}, the interstitial {@code plcmt}, and the |
There was a problem hiding this comment.
Two things in the Javadoc:
- The setter also applies to a video-only
BannerView(setAdUnitFormats(EnumSet.of(VIDEO))orsetVideoPlacementType), not only a multiformat one. - A
BannerViewnever gets the interstitialplcmt. That default applies only when the format isINTERSTITIAL.
If the builder change moves to #1021, this paragraph should say that the fields you set override the defaults and the others keep them.
There was a problem hiding this comment.
Rewrote the Javadoc: it covers video-only and multiformat BannerViews, drops the interstitial plcmt mention, and says set fields override the defaults while unset fields keep them.
| assertNull(video.playbackmethod); | ||
| // The rendering-API defaults (SDK mimes/protocols, playbackend, | ||
| // interstitial plcmt) are not applied once VideoParameters are set. | ||
| assertNull(video.playbackend); |
There was a problem hiding this comment.
assertNull(video.playbackend) pins the dropped default, and #1021 asserts the opposite (playbackend still comes from the defaults). So these two tests conflict either way.
Also, both builder tests use a single-format VAST config. Nothing covers a BannerView, or a BANNER + VIDEO config built with isInterstitial = false. A BannerViewTest case that checks the setter reaches adUnitConfig would cover the new public API.
There was a problem hiding this comment.
Reverted both builder tests to master, so there's no conflict with #1021. Added BannerViewTest cases for a BANNER + VIDEO config: the setter reaches adUnitConfig, the getter returns it, and null clears it.
…BannerView.getVideoParameters Address review feedback on prebid#1000: - Revert the BasicParameterBuilder.setVideoImpValues gate and the BasicParameterBuilderTest updates. The gate let a set VideoParameters switch the rendering imp to the original-API branch, which dropped the rendering defaults (protocols, linearity, playbackend) and, with an empty mimes list, sent no mimes at all. prebid#1021 fixes the same gap with the iOS semantics (defaults first, then publisher-set fields win). The comment that described the old isOriginalAdUnit-only gate is removed with it. - Add BannerView.getVideoParameters() to pair with the setter. - Rewrite the setVideoParameters Javadoc: it applies to video-only and multiformat BannerViews, and set fields override the defaults while unset fields keep them. - Add BannerViewTest cases for the setter, getter, and null clearing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @mdanylov-sigma, the table made the difference clear. I took the suggestion: dropped the |
Lets a video-only or multiformat (BANNER + VIDEO) BannerView carry VideoParameters. Request building applies them over the rendering video defaults (prebid#1021): fields the publisher sets win, the rest keep the defaults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1fed970 to
8f1c63e
Compare
|
@mdanylov-sigma rebased onto |
Intent to implement
#999
Scope
Multiformat request support on the rendering
BannerView(setAdUnitFormats) landed in #1010, and the request-builder gap (rendering imps ignoringVideoParameters) is fixed by #1021, which closes #1018. This PR now only adds the publicBannerViewAPI that #1018 anticipated.Change
BannerViewthat requests video: video-only (setAdUnitFormats(EnumSet.of(VIDEO))orsetVideoPlacementType) or banner + video.PrebidParameterBuilder.swift) and iOS's get/setBannerView.videoParameters.BannerViewTestcovers the setter reachingadUnitConfig, the getter, and clearing with null.Dependency
Depends on #1021 for the parameters to reach the request. I'll rebase onto
masteronce #1021 merges.Why no renderer changes are needed
BannerView → DisplayView → PrebidRenderer.createBannerAdView → PrebidDisplayView, andPrebidDisplayViewalready branches onBidResponse#isVideo()(VideoViewfor VAST, banner otherwise).Disclosure: implemented with AI assistance (Claude Code); reviewed and submitted by @nsp37.
🤖 Generated with Claude Code