Skip to main content

com.bluebillywig.bbnativeplayersdk — Functions

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. Storage-only lookup: opens, reads, closes its own connection. Use when no live player exists (e.g. rendering a "% watched" badge in a carousel).

shouldAutoResume

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

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