MediaController2.Builder
public
static
final
class
MediaController2.Builder
extends Object
| java.lang.Object | |
| ↳ | 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, Session2Token token)
Creates a builder for |
|
Public methods | |
|---|---|
MediaController2
|
build()
Build |
MediaController2.Builder
|
setConnectionHints(Bundle connectionHints)
Set the connection hints for the controller. |
MediaController2.Builder
|
setControllerCallback(Executor executor, MediaController2.ControllerCallback callback)
Set callback for the controller and its executor. |
Inherited methods | |
|---|---|
Public constructors
Builder
public Builder (Context context, Session2Token token)
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
public MediaController2 build ()
Build MediaController2.
| Returns | |
|---|---|
MediaController2 |
a new controller
This value cannot be null. |
setConnectionHints
public MediaController2.Builder setConnectionHints (Bundle connectionHints)
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. |
| Returns | |
|---|---|
MediaController2.Builder |
The Builder to allow chaining
This value cannot be null. |
setControllerCallback
public MediaController2.Builder setControllerCallback (Executor executor, MediaController2.ControllerCallback callback)
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. |
| Returns | |
|---|---|
MediaController2.Builder |
The Builder to allow chaining
This value cannot be null. |