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:
| Name | Description |
|---|---|
method | ApiMethod 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.
fitMode
nonisolated static func fitMode(fromOption value: Any?) -> FitMode?
Parses an options["fitmode"] value: a FitMode, or a FitMode entry name (case-insensitive).
fitModeReferenceSize
nonisolated static func fitModeReferenceSize(isFullScreen: Bool, fullscreenSize: CGSize, inlineSize: CGSize) -> CGSize
The size FIT_HORIZONTAL / FIT_VERTICAL compare the video against: the fullscreen size while isFullScreen
and that size is known, otherwise the inline bounds. Driven by the isFullScreen flag rather than by
presentingViewController, which is nil for AVKit's own fullscreen and non-nil for an inline player whose
host controller is itself presented modally.
fullScreenReferenceSize
nonisolated static func fullScreenReferenceSize(presentation: FullScreenPresentation, presentedViewSize: CGSize?, presentedWindowSize: CGSize?, avkitContainerSize: CGSize?, screenSize: CGSize) -> CGSize
The size the video covers in fullscreen, read live. Custom path: the presented controller's view, then its window; AVKit path: the transition container (the controller's own view is the inline, window-less one there). Both fall back to the screen size. There is intentionally no host-size input: for an embedded host (scroll page, sheet, split view) the host controller's size is the inline slot, not the fullscreen container.
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:
| Name | Description |
|---|---|
property | ApiProperty 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:
| Name | Description |
|---|---|
clipId | the media clip id |
Returns: whether the clip is considered finished
Note: Deprecated. Use
BBNativePlayer.lastKnownPosition(forClipId:)together with the clip duration: treat the clip as finished when the position is within a few seconds of the end. WithcontinueWatchingenabled the SDK applies that rule itself and does not auto-resume a finished clip.
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. Reads stored progress without instantiating a
player — e.g. for rendering a "% watched" badge on a thumbnail.
Parameters:
| Name | Description |
|---|---|
clipId | the media clip id |
Returns: the last stored position in seconds, or nil
Note: The storage-only reader now lives on
BBNativePlayer. CallBBNativePlayer.lastKnownPosition(forClipId:)instead; this alias delegates to the same implementation and remains only for backwards compatibility.
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:
| Name | Description |
|---|---|
property | ApiProperty 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.