Share via


MediaSession.Callback.OnPrepareFromMediaId(String, Bundle) Method

Definition

Override to handle requests to prepare for playing a specific mediaId that was provided by your app's MediaBrowserService.

[Android.Runtime.Register("onPrepareFromMediaId", "(Ljava/lang/String;Landroid/os/Bundle;)V", "GetOnPrepareFromMediaId_Ljava_lang_String_Landroid_os_Bundle_Handler", ApiSince=24)]
public virtual void OnPrepareFromMediaId (string? mediaId, Android.OS.Bundle? extras);
[<Android.Runtime.Register("onPrepareFromMediaId", "(Ljava/lang/String;Landroid/os/Bundle;)V", "GetOnPrepareFromMediaId_Ljava_lang_String_Landroid_os_Bundle_Handler", ApiSince=24)>]
abstract member OnPrepareFromMediaId : string * Android.OS.Bundle -> unit
override this.OnPrepareFromMediaId : string * Android.OS.Bundle -> unit

Parameters

mediaId
String
extras
Bundle
Attributes

Remarks

Override to handle requests to prepare for playing a specific mediaId that was provided by your app's MediaBrowserService. During the preparation, a session should not hold audio focus in order to allow other sessions play seamlessly. The state of playback should be updated to PlaybackState#STATE_PAUSED after the preparation is done. The playback of the prepared content should start in the implementation of #onPlay. Override #onPlayFromMediaId to handle requests for starting playback without preparation.

Java documentation for android.media.session.MediaSession.Callback.onPrepareFromMediaId(java.lang.String, android.os.Bundle).

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