Google berkomitmen untuk mendorong terwujudnya keadilan ras bagi komunitas Kulit Hitam. Lihat caranya.

Builder

class Builder : BuilderBase<MediaController!, MediaController.Builder!, MediaController.ControllerCallback!>
androidx.media2.session.MediaController.Builder

Builder for MediaController.

To set the token of the session for the controller to connect to, one of the setSessionToken(SessionToken) or setSessionCompatToken(MediaSessionCompat.Token) should be called. Otherwise, the build() will throw an IllegalArgumentException.

Any incoming event from the MediaSession will be handled on the callback executor.

Summary

Public constructors
<init>(@NonNull context: Context)

Public methods
MediaController

Builds a MediaController.

MediaController.Builder
setConnectionHints(@NonNull connectionHints: Bundle)

MediaController.Builder
setControllerCallback(@NonNull executor: Executor, @NonNull callback: MediaController.ControllerCallback)

MediaController.Builder

MediaController.Builder
setSessionToken(@NonNull token: SessionToken)

Public constructors

<init>

Builder(@NonNull context: Context)

Public methods

build

@NonNull fun build(): MediaController

Builds a MediaController.

Return
MediaController a new controller
Exceptions
IllegalArgumentException if both SessionToken and MediaSessionCompat.Token are not set.

setConnectionHints

@NonNull fun setConnectionHints(@NonNull connectionHints: Bundle): MediaController.Builder

setControllerCallback

@NonNull fun setControllerCallback(
    @NonNull executor: Executor,
    @NonNull callback: MediaController.ControllerCallback
): MediaController.Builder

setSessionCompatToken

@NonNull fun setSessionCompatToken(@NonNull compatToken: MediaSessionCompat.Token): MediaController.Builder

setSessionToken

@NonNull fun setSessionToken(@NonNull token: SessionToken): MediaController.Builder