Skip to content

Commit dc8d3ea

Browse files
marcbaechingerSheenaChhabra
authored andcommitted
Add constructor that takes only a Context
#minor-release PiperOrigin-RevId: 604659845 (cherry picked from commit c227334)
1 parent ca2779e commit dc8d3ea

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

‎RELEASENOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* Session:
2323
* Fix issue where `MediaItem.RequestMetadata` with just non-null extras is
2424
not sent transmitted between media controllers and sessions.
25+
* Add constructor to `MediaLibrarySession.Builder` that only takes a
26+
`Context` instead of a `MediaLibraryService`.
2527
* UI:
2628
* Downloads:
2729
* OkHttp Extension:

‎libraries/session/src/main/java/androidx/media3/session/MediaLibraryService.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,19 @@ public Builder(MediaLibraryService service, Player player, Callback callback) {
413413
super(service, player, callback);
414414
}
415415

416+
/**
417+
* Creates a builder for {@link MediaLibrarySession}.
418+
*
419+
* @param context The {@link Context}.
420+
* @param player The underlying player to perform playback and handle transport controls.
421+
* @param callback The callback to handle requests from {@link MediaBrowser}.
422+
* @throws IllegalArgumentException if {@link Player#canAdvertiseSession()} returns false.
423+
*/
424+
@UnstableApi
425+
public Builder(Context context, Player player, Callback callback) {
426+
super(context, player, callback);
427+
}
428+
416429
/**
417430
* Sets a {@link PendingIntent} to launch an {@link android.app.Activity} for the {@link
418431
* MediaLibrarySession}. This can be used as a quick link to an ongoing media screen.

0 commit comments

Comments
 (0)