MediaController

open class MediaController : FrameLayout
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.FrameLayout
   ↳ android.widget.MediaController

A view containing controls for a MediaPlayer. Typically contains the buttons like "Play/Pause", "Rewind", "Fast Forward" and a progress slider. It takes care of synchronizing the controls with the state of the MediaPlayer.

The way to use this class is to instantiate it programmatically. The MediaController will create a default set of controls and put them in a window floating above your application. Specifically, the controls will float above the view specified with setAnchorView(). The window will disappear if left idle for three seconds and reappear when the user touches the anchor view.

Functions like show() and hide() have no effect when MediaController is created in an xml layout. MediaController will hide and show the buttons according to these rules:

  • The "previous" and "next" buttons are hidden until setPrevNextListeners() has been called
  • The "previous" and "next" buttons are visible but disabled if setPrevNextListeners() was called with null listeners
  • The "rewind" and "fastforward" buttons are shown unless requested otherwise by using the MediaController(Context, boolean) constructor with the boolean set to false

Summary

Nested classes
abstract

Inherited XML attributes
Inherited constants
Public constructors
<init>(context: Context!, attrs: AttributeSet!)

<init>(context: Context!, useFastForward: Boolean)

<init>(context: Context!)

Public methods
open Boolean

open Unit

open Boolean

open Unit

open Unit

Set the view that acts as the anchor for the control view.

open CharSequence!

Return the class name of this object to be used for accessibility purposes.

open Boolean

open Boolean

open Unit

Show the controller on screen.

open Unit
show(timeout: Int)

Show the controller on screen.

open Unit

open Unit

Remove the controller from the screen.

open Unit
setEnabled(enabled: Boolean)

Inherited functions