Ad Options

AdOption and AdBadgeOption configure advertisement display and badge appearance for video ads. These options control ad loading behavior and the visual presentation of ad badges.

Overview

AdOption configures:

  • Ad fetch timeout

  • VAST attributes for ad delivery

AdBadgeOption configures:

  • Badge text ("Ad" or "Sponsored")

  • Badge colors and styling

  • Badge visibility on thumbnails and player

  • Custom typeface

Creating Ad Options

Using Builder

val adOption = AdOption.Builder()
    .adsFetchTimeoutInSeconds(10)
    .build()

val adBadgeOption = AdBadgeOption.Builder()
    .adBadgeTextColor(Color.WHITE)
    .adBadgeBackColor(Color.parseColor("#F65178EE"))
    .adBadgeLabel(AdBadgeTextType.SPONSORED)
    .adBadgeIsHidden(false)
    .build()

AdOption Properties

adsFetchTimeoutInSeconds

Type: Int Default: 10 seconds

Maximum time to wait for ad content to load before timing out.

vastAttributes

Type: Map<String, String> Default: Empty map

Custom attributes to pass with VAST ad requests.

AdBadgeOption Properties

adBadgeTextColor

Type: Int (color) Default: White (Color.WHITE)

Text color for the ad badge.

adBadgeBackColor

Type: Int (color) Default: Blue (0xF65178EE)

Background color for the ad badge.

adBadgeLabel

Type: AdBadgeTextType (enum) Default: SPONSORED

Text displayed on the ad badge.

Values:

  • AdBadgeTextType.SPONSORED - Displays "Sponsored"

  • AdBadgeTextType.AD - Displays "Ad"

adBadgeIsHidden

Type: Boolean Default: false

Show or hide the ad badge.

adBadgeShowOnThumbnails

Type: Boolean Default: false

Show ad badge on video thumbnails in the feed.

adBadgeTypeface

Type: Typeface Default: Typeface.DEFAULT

Custom typeface for ad badge text.

Default Values

AdOption Defaults

Property
Default Value

adsFetchTimeoutInSeconds

10

vastAttributes

Empty map

AdBadgeOption Defaults

Property
Default Value

adBadgeTextColor

White

adBadgeBackColor

0xF65178EE (blue)

adBadgeLabel

SPONSORED

adBadgeIsHidden

false

adBadgeShowOnThumbnails

false

adBadgeTypeface

Typeface.DEFAULT

Complete Examples

Standard Ad Configuration

Custom Styled Ad Badge

Minimal Ad Badge

Branded Ad Badge

High Contrast Ad Badge

Hidden Ad Badge

Quick Timeout for Fast Loading

Ad Badge Visibility

The ad badge can appear in two locations:

On Thumbnails

Shows the badge on video thumbnails in the feed, helping users identify sponsored content before clicking.

In Player

The badge always shows in the video player (unless adBadgeIsHidden is true).

Ad Badge Text Options

Displays "Sponsored" - typically used for sponsored content and brand partnerships.

"Ad" Label

Displays "Ad" - typically used for direct advertisements.

Ad Loading Behavior

Timeout Configuration

  • Shorter timeouts improve perceived performance but may miss some ads

  • Longer timeouts ensure more ads load but may delay content display

  • Default of 10 seconds balances performance and ad delivery

VAST Attributes

Custom attributes passed to VAST ad server for targeting and compliance.

Important Notes

  • Ad badges help maintain transparency about sponsored content

  • Badge visibility is separate for thumbnails and player

  • Typeface must be included in your app's font resources

  • Ad fetch timeout affects initial feed loading time

  • VAST attributes can be used for ad targeting and compliance

  • Badge colors should maintain sufficient contrast for readability

  • Consider platform advertising guidelines when configuring badges

  • Ad configuration is applied globally across the app

See Also

Last updated

Was this helpful?