PlayerView

PlayerView

class PlayerView : FrameLayout, UserInterfaceApi, EventEmitter<Event>

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

PlayerViewconstructor(context: Context)
@JvmOverloads
constructor(context: Context, player: Player?, config: PlayerViewConfig = PlayerViewConfig())constructor(context: Context, attrs: AttributeSet?)constructor(context: Context, attrs: AttributeSet?, defStyle: Int = 0)

Properties

NameSummary
configval config: PlayerViewConfig
Configures the visual presentation and behaviour of this PlayerView.
isFullscreenopen override val isFullscreen: Boolean
isPictureInPictureopen override val isPictureInPicture: Boolean
isPictureInPictureAvailableopen override val isPictureInPictureAvailable: Boolean
isUiVisibleopen override var isUiVisible: Boolean
playeropen override var player: Player?
scalingModeopen override var scalingMode: ScalingMode

Functions

NameSummary
enterFullscreenopen override fun enterFullscreen()
The player enters fullscreen mode. Has no effect if already in fullscreen.
enterPictureInPictureopen 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.
exitFullscreenopen override fun exitFullscreen()
The player exits fullscreen mode. Has no effect if not in fullscreen.
exitPictureInPictureopen 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.
getPlayeropen override fun getPlayer(): Player?
Returns the Player instance currently used by this view.
getScalingModeopen override fun getScalingMode(): ScalingMode
Returns the current ScalingMode.
isFullscreenopen override fun isFullscreen(): Boolean
Returns true if the player is currently in fullscreen mode.
isPictureInPictureopen override fun isPictureInPicture(): Boolean
Returns true if a PictureInPictureHandler is registered and PictureInPictureHandler.isPictureInPicture evaluates to true.
isPictureInPictureAvailableopen override fun isPictureInPictureAvailable(): Boolean
Returns true if a PictureInPictureHandler is registered and PictureInPictureHandler.isPictureInPictureAvailable evaluates to true.
isUiVisibleopen override fun isUiVisible(): Boolean
Returns if the UI is currently visible.
nextopen override fun <E : Event> next(eventClass: KClass<E>, action: (E) -> Unit)
offopen override fun <E : Event> off(action: (E) -> Unit)
open override fun <E : Event> off(eventClass: KClass<E>, action: (E) -> Unit)
onopen override fun <E : Event> on(eventClass: KClass<E>, action: (E) -> Unit)
onDestroyfun onDestroy()
Must be called when Activity.onDestroy is called in the Activity using this view.
onInterceptTouchEventopen override fun onInterceptTouchEvent(ev: MotionEvent): Boolean
onLayout@VisibleForTesting(otherwise = 4)
open override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)
onPausefun onPause()
Must be called when Activity.onPause is called in the Activity using this view.
onPictureInPictureModeChangedfun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean, newConfig: Configuration?)
When using Picture-in-Picture feature, this method has to be called from Activity.onPictureInPictureModeChanged method.
onResumefun onResume()
Must be called when Activity.onResume is called in the Activity using this view.
onStartfun onStart()
Must be called when Activity.onStart is called in the Activity using this view.
onStopfun onStop()
Must be called when Activity.onStop is called in the Activity using this view.
onTouchEventopen override fun onTouchEvent(event: MotionEvent): Boolean
setCustomMessageHandleropen override fun setCustomMessageHandler(customMessageHandler: CustomMessageHandler?)
Set a CustomMessageHandler which handles the communication with the Bitmovin Web UI in both directions
setFullscreenHandlerfun setFullscreenHandler(fullscreenHandler: FullscreenHandler?)
setPictureInPictureHandlerfun setPictureInPictureHandler(pipHandler: PictureInPictureHandler?)
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.
setPlayeropen 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.
setPosterImageopen override fun setPosterImage(url: String?, keepPersistent: Boolean)
Sets a poster image which will be displayed before playback starts.
setScalingModeopen override fun setScalingMode(scalingMode: ScalingMode)
Sets a new ScalingMode.
setUiVisibleopen override fun setUiVisible(visible: Boolean)
Sets if the UI should be visible or not. Default value is true.