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].
Parameters:
| Name | Description |
|---|---|
context | the view context |
jsonUrl | the json embed URL (nullable) |
options | the 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:
| Name | Description |
|---|---|
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" |
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].
Parameters:
| Name | Description |
|---|---|
activity | the app activity |
jsonUrl | the json embed URL |
options | the options dictionary (optional) |
Returns: the modal player view
createChromecastButton
fun createChromecastButton(context: Context) : MediaRouteButton
Create Chromecast button
Parameters:
| Name | Description |
|---|---|
context | the view context |
Returns: the button
getChromecastMiniControlsView
fun getChromecastMiniControlsView(context: Context) : ChromecastMiniControlsView
Get Chromecast mini controls view (singleton)
Parameters:
| Name | Description |
|---|---|
context | the view context |
Returns: the mini controls view