Skip to main content

BBNativePlayerView

class BBNativePlayerView: UIView, UIGestureRecognizerDelegate

PlayerView used to play media from the Blue Billywig OVP

Functions

callApiMethod

func callApiMethod(method: ApiMethod, args: [String : Any?]?)

Call a method in the Blue Billywig player API

Methods:*

Use the ApiMethod enumeration to choose the method to call on the API

ApiMethod.load_

Use this method to load content into the player.

  • arguments: clipId: String cliplistId: String projectId: String initiator: String autoPlay: Bool seekTo: NSNumber clipData: MediaClip clipListData: MediaClipList clipDataJsonString: String projectDataJsonString: String clipListDataJsonString: String

example:

callApiMethod(method: .load_, args: ["clipId": "1084217", "autoPlay": true])

ApiMethod.play

Starts playback

example:

callApiMethod(method: .play, args: nil)

ApiMethod.pause

Pauses playback

example:

callApiMethod(method: .pause, args: nil)

ApiMethod.autoplaynextcancel

Stops the autoplaynext timer

example:

callApiMethod(method: .autoplaynextcancel, args: nil)

ApiMethod.seek

Seek the content to the fiven time in seconds

  • arguments: offsetInSeconds: NSNumber

example:

callApiMethod(method: .seek, args: ["offsetInSeconds": 10])

Parameters:

NameDescription
methodApiMethod Enum - the type of method to call
args[String : Any?]? - The optional arguments for the choosen method

Returns: none

destroy

func destroy()

Destroys the player and handles memory cleanup. Call this method when you're done with the BBNativePlayerView instance

  • Parameter none

Returns: none

endCastSession

func endCastSession()

End the current Cast session and stop playback on the Cast device.

getApiProperty

func getApiProperty(property: ApiProperty) -> Any?

Gets a property through the Blue Billywig player API

Properties:*

Use the ApiProperty enumeration to choose the property to get

ApiProperty.clipdata

Gets the Clip data of the current MediaClip

  • return value: MediaClip

example:

if let mediaClip: MediaClip = bbPlayerView?.getApiProperty(property: .clipdata) as? MediaClip \{
.....
\}

ApiProperty.projectdata

Gets the Project data of the current Project

  • return value: Project

example:

if let project: Project = bbPlayerView?.getApiProperty(property: .projectdata) as? Project \{
.....
\}

ApiProperty.playoutdata

Gets the Playout data of the player

  • return value: Playout

example:

if let playout: Playout = bbPlayerView?.getApiProperty(property: .playoutdata) as? Playout {
.....
}

ApiProperty.duration

Gets the duration of the current content

  • return value: Double

example:

if ( bbPlayerView?.getApiProperty(property: .duration) != nil ) \{
.....
\}

ApiProperty.inview

Gets the inview state (visible on screen) of the player

  • return value: Bool

example:

bbPlayerView?.getApiProperty(property: .inview)

ApiProperty.mode

Gets the current Mode of the player

  • return value: String

example:

if let mode: String = bbPlayerView?.getApiProperty(property: .mode) as? String \{
.....
\}

ApiProperty.muted

Gets the current mute state of the player

  • return value: Bool

example:

if let muted: Bool = bbPlayerView?.getApiProperty(property: .muted) as? Bool {
.....
}

ApiProperty.phase

Gets the current Phase of the player

  • return value: Phase enum

example:

if let phase: Phase = bbPlayerView?.getApiProperty(property: .phase) as? Phase \{
.....
\}

ApiProperty.state

Gets the current State of the player

  • return value: State enum

example:

if let state: State = bbPlayerView?.getApiProperty(property: .state) as? State {
.....
}

ApiProperty.volume

Gets the current volume of the player

  • return value: Float

example:

if let volume: Float = bbPlayerView?.getApiProperty(property: .volume) as? Float \{
.....
\}

Parameters:

NameDescription
propertyApiProperty Enum - the type of property to set

Returns: Any?

isFinished

static func isFinished(forClipId clipId: String) -> Bool

Returns true when the clip was finished (watched to its natural end) and has not been watched since. Storage-only lookup; no player instance required.

Parameters:

NameDescription
clipIdthe media clip id

Returns: whether the clip is considered finished

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 clip was finished. Reads stored progress without instantiating a player — e.g. for rendering a "% watched" badge on a thumbnail.

Parameters:

NameDescription
clipIdthe media clip id

Returns: the last stored position in seconds, or nil

resumeCastSession

func resumeCastSession()

Detect and connect to an existing Chromecast session (e.g. from standalone BBCastButton). Matches Android BBNativePlayerView.resumeCastSession().

setApiProperty

func setApiProperty(property: ApiProperty, value: Any?)

Sets a property through the Blue Billywig player API

Properties:*

Use the ApiProperty enumeration to choose the property to set

ApiProperty.inview

Sets the inview state (visible on screen) of the player

  • value: Bool

example:

setApiProperty(property: .inview, value: true)

ApiProperty.muted

Mutes or unmutes the player

  • value: Bool

example:

setApiProperty(property: .muted, value: true)

ApiProperty.volume

Sets the player volume

  • value: Float

example:

setApiProperty(property: .volume, value: Float(0.73))

Parameters:

NameDescription
propertyApiProperty Enum - the type of property to set
value: Any? - The value to set

Returns: none

setCastMode

func setCastMode(_ mode: String?)

Set Cast routing mode. "auto" = auto-detect session and cast directly. nil = show dialog (default for standalone use). Native channel SDKs should set "auto".

Properties

delegate

weak var delegate: BBNativePlayerViewDelegate?

The BBNativePlayerViewDelegate

player

var player: BBNativePlayerAPI

The BBNativePlayerAPI

useFullscreenWindow

var useFullscreenWindow: Bool

When true, fullscreen uses a dedicated UIWindow to avoid SwiftUI dismissing the presentation. Set by the SwiftUI wrapper; UIKit callers leave this as false.