Builder
class Builder
| kotlin.Any | |
| ↳ | android.media.MediaController2.Builder |
This API is not generally intended for third party application developers. Use the AndroidX Media3 session Library for consistent behavior across all devices.
Builder for MediaController2.
Any incoming event from the MediaSession2 will be handled on the callback executor. If it's not set, Context.getMainExecutor() will be used by default.
Summary
| Public constructors | |
|---|---|
Builder(context: Context, token: Session2Token)Creates a builder for |
|
| Public methods | |
|---|---|
| MediaController2 |
build()Build |
| MediaController2.Builder |
setConnectionHints(connectionHints: Bundle)Set the connection hints for the controller. |
| MediaController2.Builder |
setControllerCallback(executor: Executor, callback: MediaController2.ControllerCallback)Set callback for the controller and its executor. |
Public constructors
Builder
Builder(
context: Context,
token: Session2Token)
Creates a builder for MediaController2.
| Parameters | |
|---|---|
context |
Context: context This value cannot be null. |
token |
Session2Token: token of the session to connect to This value cannot be null. |
Public methods
build
fun build(): MediaController2
Build MediaController2.
| Return | |
|---|---|
MediaController2 |
a new controller This value cannot be null. |
setConnectionHints
fun setConnectionHints(connectionHints: Bundle): MediaController2.Builder
Set the connection hints for the controller.
connectionHints is a session-specific argument to send to the session when connecting. The contents of this bundle may affect the connection result.
An IllegalArgumentException will be thrown if the bundle contains any non-framework Parcelable objects.
| Parameters | |
|---|---|
connectionHints |
Bundle: a bundle which contains the connection hints This value cannot be null. |
| Return | |
|---|---|
MediaController2.Builder |
The Builder to allow chaining This value cannot be null. |
setControllerCallback
fun setControllerCallback(
executor: Executor,
callback: MediaController2.ControllerCallback
): MediaController2.Builder
Set callback for the controller and its executor.
| Parameters | |
|---|---|
executor |
Executor: callback executor This value cannot be null. |
callback |
MediaController2.ControllerCallback: session callback. This value cannot be null. |
| Return | |
|---|---|
MediaController2.Builder |
The Builder to allow chaining This value cannot be null. |