Skip to main content

BBNativePlayer

class BBNativePlayer

BBNativePlayer offers static factory functions for creating the views that do the actual work

Functions​

createPlayerView​

fun createPlayerView(context: Context, jsonUrl: String?, options: Map<String, Any?>? = null) : BBNativePlayerView

Create a player view

  • context: any host whose context chain leads to a FragmentActivity (AppCompatActivity also works — it's a FragmentActivity). The SDK walks the ContextWrapper chain, so a ContextThemeWrapper around an activity is fine. Required for the fullscreen and settings-sheet features.
  • jsonUrl: the json embed URL (nullable)
  • options: the options dictionary (optional), options recognized:
    • adsystem_buid: app bundle id
    • adsystem_rdid: resettable device identifier
    • adsystem_idtype: identifier type ("idfa" for iOS, "adid" for Android)
    • adsystem_is_lat: limit ad tracking (Boolean)
    • adsystem_ppid: publisher-provided id
    • allowCollapseExpand: honour collapse / expand requests (Boolean or String)
    • waitForCmp: wait for Consent Management, then setup (Boolean or String)
    • handleConsentManagement: handle Consent Management (Boolean or String) -- needs waitForCmp
    • tagForUnderAgeOfConsent: (Boolean or String)
    • consent_string: default consent string (String)
    • consent_gdprApplies: default GDPR applies (Int)
    • consent_cmpVersion: default CMP version (Int)
    • autoPlay: auto play (Boolean or String), overrides playout setting
    • commercials: allow commercials (Boolean or String), overrides playout setting
    • noChromeCast: no ChromeCast support (Boolean or String), overrides playout setting
    • noStats: no stats logging (Boolean), overrides playout setting
    • forceFullscreenLandscape: rotated the video to landscape when the video goes fullscreen
    • adTagUrlParam_[key]: Custom parameters to add to ad tag URLs. Multiple parameters supported with different keys (e.g., "adTagUrlParam_userId": "12345")
    • continueWatching: persist playback position per clip and auto-seek to the stored position on the next load of the same clip (Boolean, default off). Suppressed for live streams, during ad playback, when the previous session finished the clip, and when the caller passes an explicit seekTo. Stored position is readable via [PlayHistoryManager.lastKnownPosition].
    • skin_fontHeadingId: custom heading font (String or Int), overrides the playout's skin_fontHeadingId. A positive font-clip id uses that uploaded font; a negative id means "a font already on the device", named by skin_fontHeading; "", "0" or absent means the bundled Lato. The heading role covers the video title on the start / pause / end screens, the "Related videos" header, the Shorts CTA label and the Shorts title.
    • skin_fontHeading: the heading font's name (String). Only read when skin_fontHeadingId is negative; a name on its own selects nothing.
    • skin_fontBodyId: custom body font (String or Int), overrides the playout's skin_fontBodyId. Same reading rule as skin_fontHeadingId. The body role covers everything else the player draws: control-bar times and LIVE, the settings sheet, auto-play-next, embargo text, dates and authors, related-item and shelf titles, duration badges, ad counter / countdown / skip, double-tap seek and the Shorts description.
    • skin_fontBody: the body font's name (String). Only read when skin_fontBodyId is negative. The four keys are independent per role and are applied on top of the playout, exactly as the playout's own values would be. Once created, a role's option override sticks for the view's whole lifetime: a later updatePlayoutWithJson can still change the other role, or the playout's own value for this one, but it can never dislodge the option. A font that cannot be downloaded, parsed or found on the device falls back to Lato for that role alone.

Parameters:

NameDescription
contextthe view context
jsonUrlthe json embed URL (nullable)
optionsthe options dictionary (optional)

Returns: the player view

createJsonEmbedUrl​

fun createJsonEmbedUrl(baseUrl: String, appIndicator: String, appId: String, contentIndicator: String? = null, contentId: String? = null) : String

Create a json embed URL

  • baseUrl: the base URL, e.g. "https://demo.bbvms.com"
  • appIndicator: the application indicator, e.g. "p" for player
  • appId: the application config id, e.g. the playout code
  • contentIndicator: the content indicator (optional), e.g. "c" for clip
  • contentId: the content id, e.g. "7654321"

Parameters:

NameDescription
baseUrlthe base URL, e.g. "https://demo.bbvms.com"
appIndicatorthe application indicator, e.g. "p" for player
appIdthe application config id, e.g. the playout code
contentIndicatorthe content indicator (optional), e.g. "c" for clip
contentIdthe content id, e.g. "7654321"

Returns: the json embed URL

createModalPlayerView​

fun createModalPlayerView(activity: AppCompatActivity, jsonUrl: String, options: Map<String, Any?>? = null) : BBNativePlayerView

Create a modal player view

  • activity: the app activity
  • jsonUrl: the json embed URL
  • options: the options dictionary (optional), options recognized:
    • adsystem_buid: app bundle id
    • adsystem_rdid: resettable device identifier
    • adsystem_idtype: identifier type ("idfa" for iOS, "adid" for Android)
    • adsystem_is_lat: limit ad tracking (Boolean)
    • adsystem_ppid: publisher-provided id
    • waitForCmp: wait for Consent Management, then setup (Boolean or String)
    • handleConsentManagement: handle Consent Management (Boolean or String) -- needs waitForCmp
    • tagForUnderAgeOfConsent: (Boolean or String)
    • consent_string: default consent string (String)
    • consent_gdprApplies: default GDPR applies (Int)
    • consent_cmpVersion: default CMP version (Int)
    • autoPlay: auto play (Boolean or String), overrides playout setting
    • commercials: allow commercials (Boolean or String), overrides playout setting
    • noChromeCast: no ChromeCast support (Boolean or String), overrides playout setting
    • noStats: no stats logging (Boolean), overrides playout setting
    • adTagUrlParam_[key]: Custom parameters to add to ad tag URLs. Multiple parameters supported with different keys (e.g., "adTagUrlParam_userId": "12345")
    • continueWatching: persist playback position per clip and auto-seek to the stored position on the next load of the same clip (Boolean, default off). Suppressed for live streams, during ad playback, when the previous session finished the clip, and when the caller passes an explicit seekTo. Stored position is readable via [PlayHistoryManager.lastKnownPosition].
    • skin_fontHeadingId: custom heading font (String or Int), overrides the playout's skin_fontHeadingId. A positive font-clip id uses that uploaded font; a negative id means "a font already on the device", named by skin_fontHeading; "", "0" or absent means the bundled Lato. The heading role covers the video title on the start / pause / end screens, the "Related videos" header, the Shorts CTA label and the Shorts title.
    • skin_fontHeading: the heading font's name (String). Only read when skin_fontHeadingId is negative; a name on its own selects nothing.
    • skin_fontBodyId: custom body font (String or Int), overrides the playout's skin_fontBodyId. Same reading rule as skin_fontHeadingId. The body role covers everything else the player draws: control-bar times and LIVE, the settings sheet, auto-play-next, embargo text, dates and authors, related-item and shelf titles, duration badges, ad counter / countdown / skip, double-tap seek and the Shorts description.
    • skin_fontBody: the body font's name (String). Only read when skin_fontBodyId is negative. The four keys are independent per role and are applied on top of the playout, exactly as the playout's own values would be. Once created, a role's option override sticks for the view's whole lifetime: a later updatePlayoutWithJson can still change the other role, or the playout's own value for this one, but it can never dislodge the option. A font that cannot be downloaded, parsed or found on the device falls back to Lato for that role alone.

Parameters:

NameDescription
activitythe app activity
jsonUrlthe json embed URL
optionsthe options dictionary (optional)

Returns: the modal player view

createChromecastButton​

fun createChromecastButton(context: Context) : MediaRouteButton

Create Chromecast button

Parameters:

NameDescription
contextthe view context

Returns: the button

getChromecastMiniControlsView​

fun getChromecastMiniControlsView(context: Context) : ChromecastMiniControlsView

Get Chromecast mini controls view (singleton)

Parameters:

NameDescription
contextthe view context

Returns: the mini controls view