BBNativePlayerView
class)
class BBNativePlayerView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
): FrameLayout(context, attrs, defStyleAttr) , EventListenerInterface
BBNativePlayerView is what you place in your layout. It extends the platform’s core UI View class (more specifically: FrameLayout)
Constructor
no need to call this directly; use BBNativePlayer's createPlayerView factory function
Parameters
| Name | Description |
|---|---|
context | should resolve to a FragmentActivity. (AppCompatActivity does that) |
attrs | (optional, default: null) |
defStyleAttr | (optional, default: 0) |
Properties
player
val player: BBNativePlayerAPI?
Player API
delegate
var delegate: BBNativePlayerViewDelegate?
Delegate for handling API events
Functions
dispatchKeyEvent
fun dispatchKeyEvent(event: KeyEvent) : Boolean
Anchors keyboard focus on this container rather than on the player surfaces inside it (#17832).
The surfaces are disposable: the inline view is swapped for the auxiliary one during ads and for a re-parented copy in fullscreen. Holding focus on any of them means losing focus every time one is destroyed — and Android then restarts its focus search at the activity root, so it lands on the first focusable view in the host app (in the demo, the URL field above the player). This view outlives every one of those swaps, so focus stays put.
__destruct
fun __destruct()
Destruct, freeing all memory allocated internally
callApiMethod
fun callApiMethod(method: ApiMethod, args: Map<String, Any?>?)
Call API method
- method: the method enumerated by ApiMethod (see: bbnativeshared)
- args: the arguments, if any
Parameters:
| Name | Description |
|---|---|
method | the method enumerated by ApiMethod (see: bbnativeshared) |
args | the arguments, if any |
setApiProperty
fun setApiProperty(property: ApiProperty, value: Any?)
Set API property
- property: the property enumerated by ApiProperty (see: bbnativeshared)
- value: the value (nullable)
Parameters:
| Name | Description |
|---|---|
property | the property enumerated by ApiProperty (see: bbnativeshared) |
value | the value (nullable) |
getApiProperty
fun getApiProperty(property: ApiProperty) : Any?
Get API property
- property: the property enumerated by ApiProperty (see: bbnativeshared)
- returns: the value (nullable)
Parameters:
| Name | Description |
|---|---|
property | the property enumerated by ApiProperty (see: bbnativeshared) |
Returns: value the value (nullable)
destroy
fun destroy()
Destroy, freeing all memory allocated internally
showController
fun showController()
Surface the player's controls bar (cast / play / settings / etc.).
Forwards to the underlying ExoPlayer PlayerView.showController().
Safe to call when the controls bar is already shown.
Used by TV shells that programmatically dispatch clicks on individual
controls (e.g. exo_settings_icon) from remote-key handlers — those
clicks register against the inner buttons even when the bar is hidden,
but visually the user sees a single floating glyph instead of a proper
controls overlay. Calling this first guarantees the bar is laid out.
resumeCastSession
fun resumeCastSession () : Unit
Resume Google Cast session => meant to be called in onResume lifecycle hook
pauseCastSession
fun pauseCastSession () : Unit
Pause Google Cast session => meant to be called in onPause lifecycle hook
setupCastMenuItem
fun setupCastMenuItem(menu: Menu, mediaRouteMenuItemId: Int)
Set up MediaRoute menu item as Google Cast item
Parameters:
| Name | Description |
|---|---|
menu | |
mediaRouteMenuItemId |
setupCastButton
fun setupCastButton(button: MediaRouteButton?)
Set up MediaRoute button as Google Cast button
Parameters:
| Name | Description |
|---|---|
button |