Skip to content

feat(rendering): add BannerView.setVideoParameters / getVideoParameters - #1000

Merged
mdanylov-sigma merged 1 commit into
prebid:masterfrom
nsp37:feat/rendering-bannerview-multiformat
Dec 2, 2026
Merged

mdanylov-sigma merged 1 commit into
prebid:masterfrom
nsp37:feat/rendering-bannerview-multiformat

Conversation

@nsp37

@nsp37 nsp37 commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Intent to implement

#999

Scope

Multiformat request support on the rendering BannerView (setAdUnitFormats) landed in #1010, and the request-builder gap (rendering imps ignoring VideoParameters) is fixed by #1021, which closes #1018. This PR now only adds the public BannerView API that #1018 anticipated.

Change

// BannerView
public void setVideoParameters(@Nullable VideoParameters videoParameters) // -> adUnitConfig.setVideoParameters(...)
@Nullable public VideoParameters getVideoParameters()                    // -> adUnitConfig.getVideoParameters()
  • Applies to any BannerView that requests video: video-only (setAdUnitFormats(EnumSet.of(VIDEO)) or setVideoPlacementType) or banner + video.
  • With Apply VideoParameters over the rendering API video defaults #1021, the fields the publisher sets override the SDK video defaults and the rest keep them, matching iOS (PrebidParameterBuilder.swift) and iOS's get/set BannerView.videoParameters.
  • BannerViewTest covers the setter reaching adUnitConfig, the getter, and clearing with null.

Dependency

Depends on #1021 for the parameters to reach the request. I'll rebase onto master once #1021 merges.

Why no renderer changes are needed

BannerView → DisplayView → PrebidRenderer.createBannerAdView → PrebidDisplayView, and PrebidDisplayView already branches on BidResponse#isVideo() (VideoView for VAST, banner otherwise).


Disclosure: implemented with AI assistance (Claude Code); reviewed and submitted by @nsp37.

🤖 Generated with Claude Code

@nsp37

nsp37 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review — both points were spot-on. Pushed a follow-up commit taking option (a).

setVideoParameters() inert beyond ad size: relaxed the gate in BasicParameterBuilder.setVideoImpValues() so it reads VideoParameters on the rendering path too, not just when isOriginalAdUnit():

if (adConfiguration.isOriginalAdUnit() || adConfiguration.getVideoParameters() != null)

It's guarded on getVideoParameters() != null, so rendering units that never call setVideoParameters keep the existing default branch untouched — no behavior change for current rendering interstitials. I deliberately did not flip isOriginalAdUnit since it drives far more than video imp building.

Non-interstitial video.placement: this is resolved by the same change rather than a new setter — the caller's VideoParameters carry placement/plcmt, which the now-reachable branch reads, so a multiformat BannerView no longer falls back to PlacementType.INTERSTITIAL. That avoids the setVideoPlacementType() conflict you noted (it collapses formats to VAST-only, so it can't combine with setAdUnitFormats anyway).

Happy to add tests or adjust the approach (e.g. a dedicated non-original branch instead of the ||) if you'd prefer.

nsp37 added a commit to Antengo/prebid-mobile-android that referenced this pull request Sep 30, 2026
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).
@nsp37

nsp37 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

@mdanylov-sigma @YuriyVelichkoPI friendly bump. The follow-up from Sep 2 addressed the earlier feedback, and the PR has no conflicts with master. Could one of you review it when you get a chance?

@mdanylov-sigma mdanylov-sigma left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things in the Javadoc:

  • The setter also applies to a video-only BannerView (setAdUnitFormats(EnumSet.of(VIDEO)) or setVideoPlacementType), not only a multiformat one.
  • A BannerView never gets the interstitial plcmt. That default applies only when the format is INTERSTITIAL.

If the builder change moves to #1021, this paragraph should say that the fields you set override the defaults and the others keep them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

nsp37 added a commit to nsp37/prebid-mobile-android that referenced this pull request Nov 25, 2026
…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>
@nsp37 nsp37 changed the title feat(rendering): allow multiformat (banner + video) on BannerView feat(rendering): add BannerView.setVideoParameters / getVideoParameters Nov 25, 2026
@nsp37

nsp37 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @mdanylov-sigma, the table made the difference clear. I took the suggestion: dropped the BasicParameterBuilder change and the BasicParameterBuilderTest updates in favor of #1021, kept the BannerView setter, added getVideoParameters(), fixed the Javadoc, and added BannerViewTest coverage. Retitled the PR too. I'll rebase onto master once #1021 merges. BannerViewTest and BasicParameterBuilderTest pass locally.

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>
@nsp37
nsp37 force-pushed the feat/rendering-bannerview-multiformat branch from 1fed970 to 8f1c63e Compare December 2, 2026 03:16
@nsp37

nsp37 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@mdanylov-sigma rebased onto master now that #1021 is in. The PR is a single commit (8f1c63e) touching only BannerView and BannerViewTest. BannerViewTest (80) and BasicParameterBuilderTest (58) pass locally. Ready for another look.

@mdanylov-sigma
mdanylov-sigma merged commit 7c21e24 into prebid:master Dec 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VideoParameters fields beyond ad size are dropped for rendering-API banner ad units

2 participants