Udostępnij za pośrednictwem


Activity.MediaController Property

Definition

Gets the controller which should be receiving media key and volume events while this activity is in the foreground. -or- Sets a MediaController to send media keys and volume changes to.

public Android.Media.Session.MediaController? MediaController { [Android.Runtime.Register("getMediaController", "()Landroid/media/session/MediaController;", "")] get; [Android.Runtime.Register("setMediaController", "(Landroid/media/session/MediaController;)V", "")] set; }
[<get: Android.Runtime.Register("getMediaController", "()Landroid/media/session/MediaController;", "")>]
[<set: Android.Runtime.Register("setMediaController", "(Landroid/media/session/MediaController;)V", "")>]
member this.MediaController : Android.Media.Session.MediaController with get, set

Property Value

The controller which should receive events.

Attributes

Remarks

Property getter documentation:

Gets the controller which should be receiving media key and volume events while this activity is in the foreground.

Java documentation for android.app.Activity.getMediaController().

Property setter documentation:

Sets a MediaController to send media keys and volume changes to.

The controller will be tied to the window of this Activity. Media key and volume events which are received while the Activity is in the foreground will be forwarded to the controller and used to invoke transport controls or adjust the volume. This may be used instead of or in addition to #setVolumeControlStream to affect a specific session instead of a specific stream.

It is not guaranteed that the hardware volume controls will always change this session's volume (for example, if a call is in progress, its stream's volume may be changed instead). To reset back to the default use null as the controller.

Java documentation for android.app.Activity.setMediaController(android.media.session.MediaController).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also