Skip to main content

com.bluebillywig.bbnativeplayersdk — Functions

updateSettings​

fun updateSettings(settings: Map<String, Any?>)

Stores the settings that are present and rebuilds and reloads the page, repeat values or not (iOS does the same; [ErrorScreenView] drops unchanged font values before they get here, #20290). Fonts: #20276.

shouldAutoResume​

fun shouldAutoResume(entry: PlayHistoryEntry, duration: Double? = null) : Boolean

Seconds-before-duration to treat a clip as "finished" — at or past this point, do not auto-resume.

shouldAutoResume​

fun shouldAutoResume(entry: PlayHistoryEntry, duration: Double? = null) : Boolean

Whether the SDK should auto-seek to this entry's lastTimeOffset on a new load of the same clip.

Pure logic — safe to call statically without a manager instance.

Returns false when:

  • the offset is 0 or negative (nothing to resume),
  • the clip was last finished AFTER its last play-start (lastFinishedTS > lastPlayedTS) — i.e. the user watched to the natural end and hasn't replayed since; restart from 0,
  • duration is known and the offset is within [FINISHED_THRESHOLD_SECONDS] of it (belt-and- braces against missed bb_media_finished events, e.g. crash near end of clip).

duration may be null when called early in the load flow (clip metadata not yet resolved). The lastFinishedTS heuristic still catches the "watched to end, came back" case without it. Live streams persist no offset to begin with (see [_onMediaTimeUpdateThrottled]).

lastKnownPosition​

fun lastKnownPosition(context: Context, clipId: String) : Int?

Returns the persisted lastTimeOffset (seconds) for the given clip, or null if absent / 0 / DB error.

shouldAutoResume​

fun shouldAutoResume(entry: PlayHistoryEntry, duration: Double? = null) : Boolean

Instance shim for [Companion.shouldAutoResume] — see that method for the contract.

sizes​

fun sizes(companionAdSizesOption: Any?) : List<CompanionAdSize>

The default sizes plus the companionAdSizes option ([[width, height], ...]); invalid entries are ignored.

slotBox​

fun slotBox(screenShortSidePx: Int) : CompanionAdSize

The fixed size of each slot container: a 16:9 box of half the screen's short side. Fixed, because IMA fills the slots while the outstream player may still be collapsed.

slotDensity​

fun slotDensity(displayDensity: Float, box: CompanionAdSize, sizes: List<CompanionAdSize>) : Float

IMA renders a slot at setSize() x display density and rejects it when that exceeds the slot container or the screen. Return a density at which every size fits [box]; the filled creative is laid out at player size afterwards, so this density does not affect its sharpness.

selectWinner​

fun selectWinner(filled: List<CompanionAdSize>, playerWidth: Int, playerHeight: Int) : CompanionAdSize?

Aspect closest to the player wins; on an aspect tie the larger area wins.

fit​

fun fit(size: CompanionAdSize, playerWidth: Int, playerHeight: Int) : CompanionAdSize

The largest size with the companion's aspect that fits in the player.