PlayerView

A view that provides the Bitmovin Player Web UI and default UI handling to an attached Player instance. A Player with a custom PlayerConfig can be provided. If no player is provided, a player with a default PlayerConfig will be created. In order to not create such a default player, null can be passed in the constructor.

When inflating this view, a player with a default PlayerConfig will be created. In order to inflate without a player, initialize_player can be set to false in the XML layout.

Constructors

Link copied to clipboard
constructor(context: Context)
constructor(context: Context, player: Player?, config: PlayerViewConfig = PlayerViewConfig())
constructor(context: Context, attrs: AttributeSet?)
constructor(context: Context, attrs: AttributeSet?, defStyle: Int = 0)

Properties

Link copied to clipboard

Configures the visual presentation and behaviour of this PlayerView.

Functions

Link copied to clipboard
open override fun enterFullscreen()

The player enters fullscreen mode. Has no effect if already in fullscreen.

Link copied to clipboard
open override fun enterPictureInPicture()

The player enters Picture-In-Picture (PiP) mode. Has no effect if isPictureInPictureAvailable returns false or view is already in PiP mode.

Link copied to clipboard
open override fun exitFullscreen()

The player exits fullscreen mode. Has no effect if not in fullscreen.

Link copied to clipboard
open override fun exitPictureInPicture()

The player exits Picture-In-Picture (PiP) mode. Has no effect if .isPictureInPictureAvailable returns false or view is currently not in PiP mode.

Link copied to clipboard
open override fun getPlayer(): Player?

Returns the Player instance currently used by this view.

Link copied to clipboard
open override fun getScalingMode(): ScalingMode

Returns the current `ScalingMode`.

Link copied to clipboard
open override fun isFullscreen(): Boolean

Returns true if the player is currently in fullscreen mode.

Link copied to clipboard
open override fun isPictureInPicture(): Boolean

Returns true if a PictureInPictureHandler is registered and PictureInPictureHandler.isPictureInPicture evaluates to true.

Link copied to clipboard

Returns true if a PictureInPictureHandler is registered and PictureInPictureHandler.isPictureInPictureAvailable evaluates to true.

Link copied to clipboard
open override fun isUiVisible(): Boolean

Returns if the UI is currently visible.

Link copied to clipboard
open override fun <E : Event> next(eventClass: KClass<E>, action: (E) -> Unit)
Link copied to clipboard
open override fun <E : Event> off(action: (E) -> Unit)
open override fun <E : Event> off(eventClass: KClass<E>, action: (E) -> Unit)
Link copied to clipboard
open override fun <E : Event> on(eventClass: KClass<E>, action: (E) -> Unit)
Link copied to clipboard
fun onDestroy()

Must be called when Activity.onDestroy is called in the Activity using this view.

Link copied to clipboard
open override fun onInterceptTouchEvent(ev: MotionEvent): Boolean
Link copied to clipboard
fun onPause()

Must be called when Activity.onPause is called in the Activity using this view.

Link copied to clipboard
fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean, newConfig: Configuration?)

When using Picture-in-Picture feature, this method has to be called from Activity.onPictureInPictureModeChanged method.

Link copied to clipboard
fun onResume()

Must be called when Activity.onResume is called in the Activity using this view.

Link copied to clipboard
fun onStart()

Must be called when Activity.onStart is called in the Activity using this view.

Link copied to clipboard
fun onStop()

Must be called when Activity.onStop is called in the Activity using this view.

Link copied to clipboard
open override fun onTouchEvent(event: MotionEvent): Boolean
Link copied to clipboard
open override fun setCustomMessageHandler(customMessageHandler: CustomMessageHandler?)

Set a CustomMessageHandler which handles the communication with the Bitmovin Web UI in both directions

Link copied to clipboard
fun setFullscreenHandler(fullscreenHandler: FullscreenHandler?)
Link copied to clipboard

Set a PictureInPictureHandler to handle Picture-In-Picture (PiP) mode. Can be set to null to remove the picture in picture handler. Initially, no PictureInPictureHandler is set.

Link copied to clipboard
open override fun setPlayer(player: Player?)

Sets the Player instance, for which the UI acts. If a Player is already set, it will be detached before the new one is attached. Also, if null is provided, the currently attached Player will be detached.

Link copied to clipboard
open override fun setPosterImage(url: String?, keepPersistent: Boolean)

Sets a poster image which will be displayed before playback starts.

Link copied to clipboard
open override fun setScalingMode(scalingMode: ScalingMode)

Sets a new `ScalingMode`.

Link copied to clipboard
open override fun setUiVisible(visible: Boolean)

Sets if the UI should be visible or not. Default value is true.