Skip to main content

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)

Parameters

NameDescription
contextshould resolve (directly, or via a ContextWrapper chain
— including ContextThemeWrapper) to a FragmentActivity for the
fullscreen and settings-sheet features. AppCompatActivity also works,
it's a FragmentActivity. AppCompatActivity is only required for
showing/hiding the host's support ActionBar around fullscreen, which
is soft-cast and silently skipped on a bare FragmentActivity — host
apps on bare FragmentActivity are responsible for any toolbar
visibility around fullscreen themselves.
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

__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:

NameDescription
methodthe method enumerated by ApiMethod (see: bbnativeshared)
argsthe 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:

NameDescription
propertythe property enumerated by ApiProperty (see: bbnativeshared)
valuethe value (nullable)

getApiProperty

fun getApiProperty(property: ApiProperty) : Any?

Get API property

  • property: the property enumerated by ApiProperty (see: bbnativeshared)
  • returns: the value (nullable)

Parameters:

NameDescription
propertythe 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:

NameDescription
menu
mediaRouteMenuItemId

setupCastButton

fun setupCastButton(button: MediaRouteButton?)

Set up MediaRoute button as Google Cast button

Parameters:

NameDescription
button