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
| PlayerView | constructor(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
| Name | Summary |
|---|---|
| config | val config: PlayerViewConfig Configures the visual presentation and behaviour of this PlayerView. |
| isFullscreen | open override val isFullscreen: Boolean |
| isPictureInPicture | open override val isPictureInPicture: Boolean |
| isPictureInPictureAvailable | open override val isPictureInPictureAvailable: Boolean |
| isUiVisible | open override var isUiVisible: Boolean |
| player | open override var player: Player? |
| scalingMode | open override var scalingMode: ScalingMode |
Functions
| Name | Summary |
|---|---|
| enterFullscreen | open override fun enterFullscreen() The player enters fullscreen mode. Has no effect if already in fullscreen. |
| enterPictureInPicture | 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. |
| exitFullscreen | open override fun exitFullscreen() The player exits fullscreen mode. Has no effect if not in fullscreen. |
| exitPictureInPicture | 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. |
| getPlayer | open override fun getPlayer(): Player? Returns the Player instance currently used by this view. |
| getScalingMode | open override fun getScalingMode(): ScalingMode Returns the current ScalingMode. |
| isFullscreen | open override fun isFullscreen(): Boolean Returns true if the player is currently in fullscreen mode. |
| isPictureInPicture | open override fun isPictureInPicture(): Boolean Returns true if a PictureInPictureHandler is registered and PictureInPictureHandler.isPictureInPicture evaluates to true. |
| isPictureInPictureAvailable | open override fun isPictureInPictureAvailable(): Boolean Returns true if a PictureInPictureHandler is registered and PictureInPictureHandler.isPictureInPictureAvailable evaluates to true. |
| isUiVisible | open override fun isUiVisible(): Boolean Returns if the UI is currently visible. |
| next | open override fun <E : Event> next(eventClass: KClass<E>, action: (E) -> Unit) |
| off | open override fun <E : Event> off(action: (E) -> Unit) open override fun <E : Event> off(eventClass: KClass<E>, action: (E) -> Unit) |
| on | open override fun <E : Event> on(eventClass: KClass<E>, action: (E) -> Unit) |
| onDestroy | fun onDestroy() Must be called when Activity.onDestroy is called in the Activity using this view. |
| onInterceptTouchEvent | open override fun onInterceptTouchEvent(ev: MotionEvent): Boolean |
| onLayout | @VisibleForTesting(otherwise = 4) open override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) |
| onPause | fun onPause() Must be called when Activity.onPause is called in the Activity using this view. |
| onPictureInPictureModeChanged | fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean, newConfig: Configuration?) When using Picture-in-Picture feature, this method has to be called from Activity.onPictureInPictureModeChanged method. |
| onResume | fun onResume() Must be called when Activity.onResume is called in the Activity using this view. |
| onStart | fun onStart() Must be called when Activity.onStart is called in the Activity using this view. |
| onStop | fun onStop() Must be called when Activity.onStop is called in the Activity using this view. |
| onTouchEvent | open override fun onTouchEvent(event: MotionEvent): Boolean |
| setCustomMessageHandler | open override fun setCustomMessageHandler(customMessageHandler: CustomMessageHandler?) Set a CustomMessageHandler which handles the communication with the Bitmovin Web UI in both directions |
| setFullscreenHandler | fun setFullscreenHandler(fullscreenHandler: FullscreenHandler?) |
| setPictureInPictureHandler | fun 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. |
| setPlayer | 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. |
| setPosterImage | open override fun setPosterImage(url: String?, keepPersistent: Boolean) Sets a poster image which will be displayed before playback starts. |
| setScalingMode | open override fun setScalingMode(scalingMode: ScalingMode) Sets a new ScalingMode. |
| setUiVisible | open override fun setUiVisible(visible: Boolean) Sets if the UI should be visible or not. Default value is true. |