MediaControlView2

open class MediaControlView2 : ViewGroup
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ androidx.media.widget.MediaControlView2

A View that contains the controls for android.media.MediaPlayer. It provides a wide range of buttons that serve the following functions: play/pause, rewind/fast-forward, skip to next/previous, select subtitle track, enter/exit full screen mode, adjust video quality, select audio track, mute/unmute, and adjust playback speed.

MediaControlView2 can be initialized in two different ways: 1) When initializing VideoView2 a default MediaControlView2 is created. 2) Initialize MediaControlView2 programmatically and add it to a ViewGroup instance. In the first option, VideoView2 automatically connects MediaControlView2 to MediaController, which is necessary to communicate with MediaSession. In the second option, however, the developer needs to manually retrieve a MediaController instance from MediaSession and set it to MediaControlView2.

There is no separate method that handles the show/hide behavior for MediaControlView2. Instead, one can directly change the visibility of this view by calling View#setVisibility(int). The values supported are View.VISIBLE and View.GONE.

In addition, the following customizations are supported: 1) Set focus to the play/pause button by calling requestPlayButtonFocus(). 2) Set full screen mode

Summary

Nested classes
abstract

Interface definition of a callback to be invoked to inform the fullscreen mode is changed.

Public constructors
<init>(context: Context)

<init>(context: Context, attrs: AttributeSet?)

<init>(context: Context, attrs: AttributeSet?, defStyleAttr: Int)

Public methods
open Boolean

open Unit

open Boolean

open CharSequence!

open Unit

Registers a callback to be invoked when the fullscreen mode should be changed.

open Boolean

open LayoutParams!

open LayoutParams!

open Boolean

open Unit

Requests focus for the play/pause button.

open Unit
setEnabled(enabled: Boolean)

open Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)

open LayoutParams!

Protected methods
open Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)

Public constructors

<init>

MediaControlView2(context: Context)

<init>

MediaControlView2(context: Context, attrs: AttributeSet?)

<init>

MediaControlView2(context: Context, attrs: AttributeSet?, defStyleAttr: Int)

Public methods

onTouchEvent

open fun onTouchEvent(ev: MotionEvent!): Boolean

onVisibilityAggregated

open fun onVisibilityAggregated(isVisible: Boolean): Unit

checkLayoutParams

open fun checkLayoutParams(p: LayoutParams!): Boolean

getAccessibilityClassName

open fun getAccessibilityClassName(): CharSequence!

setOnFullScreenListener

open fun setOnFullScreenListener(l: MediaControlView2.OnFullScreenListener!): Unit

Registers a callback to be invoked when the fullscreen mode should be changed.

Parameters
l MediaControlView2.OnFullScreenListener!: The callback that will be run

onTrackballEvent

open fun onTrackballEvent(ev: MotionEvent!): Boolean

generateLayoutParams

open fun generateLayoutParams(attrs: AttributeSet!): LayoutParams!

generateLayoutParams

open fun generateLayoutParams(lp: LayoutParams!): LayoutParams!

shouldDelayChildPressedState

open fun shouldDelayChildPressedState(): Boolean

requestPlayButtonFocus

open fun requestPlayButtonFocus(): Unit

Requests focus for the play/pause button.

setEnabled

open fun setEnabled(enabled: Boolean): Unit

onMeasure

open fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int): Unit

generateDefaultLayoutParams

open fun generateDefaultLayoutParams(): LayoutParams!

Protected methods

onLayout

protected open fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int): Unit