BBNativePlayer
class BBNativePlayer
A Utility class to create players
Functions
createChromeCastButton
static func createChromeCastButton(frame: CGRect) -> GCKUICastButton?
Create a ChromeCast button
Returns: GCKUICastButton
createJsonEmbedUrl
static func createJsonEmbedUrl(baseUrl: String, appIndicator: String, appId: String, contentIndicator: String? = nil, contentId: String? = nil) -> String
Create a json embed URL
- Parameter baseUrl the base URL, e.g. "https://demo.bbvms.com"
- Parameter appIndicator the application indicator, e.g. "p" for player
- Parameter appId the application config id, e.g. the playout code, or "_"
- Parameter contentIndicator the content indicator (optional), e.g. "c" for clip, "l" for list, "p" for project, "q" for query
- Parameter contentId the content id (optional), e.g. "7654321"
- Returns the json embed URL
createModalPlayerView
static func createModalPlayerView(uiViewContoller: UIViewController, jsonUrl: String, options: [String : Any]? ) -> BBNativePlayerView
Creates a BBNativePlayerView and presents it as a full screen modal
Parameters:
| Name | Description |
|---|---|
uiViewContoller | UIViewController - is used to present the modal player |
jsonUrl | The EMBED url the player will use to setup |
options | A dictionary with options to send to the player st creation. - Options: - "adsystem_ppid": String used to fill the ppid for google IMA - "adsystem_buid": String used for adsystem macro replacement - "adsystem_rdid": String used for adsystem macro replacement - "adsystem_idtype": String used for adsystem macro replacement - "adsystem_is_lat": Bool used for adsystem macro replacement - "noStats": Bool disables statistics logging when true, overrides playout setting - "fitmode": String or FitMode a FitMode name (e.g. "FIT_OVERSCAN", case-insensitive) or a FitMode, overrides playout setting until the next setupWithJsonUrl; an unknown name is ignored and the playout fit mode applies - "jwt": String content-protection token, sent as Authorization: Bearer <jwt> header to Blue Billywig hosts only; a jwt in load / updatePlayout replaces it - "rpcToken": String content-protection rpc token, sent as rpctoken header to Blue Billywig hosts only; a jwt in load / updatePlayout replaces it - "commercials": Bool allow commercials, overrides playout setting - "allowCollapseExpand": Bool honour collapse / expand requests - "waitForCmp": Bool wait for Consent Management, then setup - "handleConsentManagement": Bool handle Consent Management -- needs waitForCmp - "tagForUnderAgeOfConsent": Bool - "consent_string": String default consent string - "consent_gdprApplies": Int default GDPR applies - "consent_cmpVersion": Int default CMP version - "autoPlay": Bool auto play, overrides playout setting - "noChromeCast": Bool disables chromeCast functionality when true, overrides playout setting castButton - "showChromeCastMiniControlsInPlayer": Bool (default false) Shows the ChromeCast MiniControls in the player when needed - "adTagUrlParam_[key]": Any Custom parameters to add to ad tag URLs. Multiple parameters supported with different keys (e.g., "adTagUrlParam_userId": "12345") - "companionAdSizes": [[Int]] additional outstream companion ad sizes to match, as [width, height] pairs (e.g. [[970, 250], [336, 280]]); added on top of the built-in sizes - "showBackArrow": Bool shows a back arrow in the top-left corner of the modal player that closes the modal |
Returns: BBNativePlayerView
createModalPlayerView
static func createModalPlayerView(uiViewContoller: UIViewController, jsonUrl: String ) -> BBNativePlayerView
Creates a BBNativePlayerView and presents it as a full screen modal
Parameters:
| Name | Description |
|---|---|
uiViewContoller | UIViewController - is used to present the modal player |
jsonUrl | The EMBED url the player will use to setup |
Returns: BBNativePlayerView
createPlayerView
static func createPlayerView( uiViewController: UIViewController, frame: CGRect, jsonUrl: String, options: [String : Any]? ) -> BBNativePlayerView
Creates a BBNativePlayerView
Parameters:
| Name | Description |
|---|---|
frame | The size of the player |
jsonUrl | The EMBED url the player will use to setup |
options | A dictionary with options to send to the player st creation. - Options: - "adsystem_ppid": String used to fill the ppid for google IMA - "adsystem_buid": String used for adsystem macro replacement - "adsystem_rdid": String used for adsystem macro replacement - "adsystem_idtype": String used for adsystem macro replacement - "adsystem_is_lat": Bool used for adsystem macro replacement - "noStats": Bool disables statistics logging when true, overrides playout setting - "fitmode": String or FitMode a FitMode name (e.g. "FIT_OVERSCAN", case-insensitive) or a FitMode, overrides playout setting until the next setupWithJsonUrl; an unknown name is ignored and the playout fit mode applies - "jwt": String content-protection token, sent as Authorization: Bearer <jwt> header to Blue Billywig hosts only; a jwt in load / updatePlayout replaces it - "rpcToken": String content-protection rpc token, sent as rpctoken header to Blue Billywig hosts only; a jwt in load / updatePlayout replaces it - "commercials": Bool allow commercials, overrides playout setting - "allowCollapseExpand": Bool honour collapse / expand requests - "waitForCmp": Bool wait for Consent Management, then setup - "handleConsentManagement": Bool handle Consent Management -- needs waitForCmp - "tagForUnderAgeOfConsent": Bool - "consent_string": String default consent string - "consent_gdprApplies": Int default GDPR applies - "consent_cmpVersion": Int default CMP version - "autoPlay": Bool auto play, overrides playout setting - "noChromeCast": Bool disables chromeCast functionality when true, overrides playout setting castButton - "showChromeCastMiniControlsInPlayer": Bool (default false) Shows the ChromeCast MiniControls in the player when needed - "forceFullscreenLandscape": Bool rotate the video to landscape when the video goes fullscreen - "adTagUrlParam_[key]": Any Custom parameters to add to ad tag URLs. Multiple parameters supported with different keys (e.g., "adTagUrlParam_userId": "12345") - "companionAdSizes": [[Int]] additional outstream companion ad sizes to match, as [width, height] pairs (e.g. [[970, 250], [336, 280]]); added on top of the built-in sizes |
Returns: BBNativePlayerView
createPlayerView
static func createPlayerView( uiViewController: UIViewController, frame: CGRect, jsonUrl: String ) -> BBNativePlayerView
Creates a BBNativePlayerView
Parameters:
| Name | Description |
|---|---|
frame | The size of the player |
jsonUrl | The EMBED url the player will use to setup |
Returns: BBNativePlayerView
getChromeCastMiniControlsView
static func getChromeCastMiniControlsView() -> UIView?
Get the singleton ChromeCast mini controls
Returns: UIView
lastKnownPosition
static func lastKnownPosition(forClipId clipId: String) -> Double?
Returns the persisted resume position in seconds for the given clip, or nil when there is
no stored record or the stored position is 0.
Storage-only lookup: reads stored progress without instantiating a player — e.g. for deciding a
seekTo before creating a player view, or rendering a "% watched" badge on a thumbnail.
A finished clip still returns its last position, which is close to the clip duration. Before
using the value as a seekTo, check it against the duration: a position within a few seconds
of the end means the clip was finished, so start from 0.
Parameters:
| Name | Description |
|---|---|
clipId | the media clip id |
Returns: the last stored position in seconds, or nil