Commit f3dd3610 by bachinger Committed by Ian Baker

Improve JavaDoc of MediaSession.release

Specifically mention that releasing the session does not release the player and the app needs to take care to release the player.

Issue: androidx/media#73
PiperOrigin-RevId: 448454338
parent 4ce60968
...@@ -516,7 +516,7 @@ public class MediaSession { ...@@ -516,7 +516,7 @@ public class MediaSession {
} }
/** /**
* Sets the underlying {@link Player} for this session to dispatch incoming event to. * Sets the underlying {@link Player} for this session to dispatch incoming events to.
* *
* @param player A player that handles actual media playback in your app. * @param player A player that handles actual media playback in your app.
* @throws IllegalArgumentException if the new player's application looper differs from the * @throws IllegalArgumentException if the new player's application looper differs from the
...@@ -532,7 +532,16 @@ public class MediaSession { ...@@ -532,7 +532,16 @@ public class MediaSession {
impl.setPlayer(player); impl.setPlayer(player);
} }
/** Releases the session. */ /**
* Releases the session and disconnects all connected controllers.
*
* <p>The session must not be used after calling this method.
*
* <p>Releasing the session removes the session's listeners from the player but does not
* {@linkplain Player#stop() stop} or {@linkplain Player#release() release} the player. An app can
* further use the player after the session is released and needs to make sure to eventually
* release the player.
*/
public void release() { public void release() {
try { try {
synchronized (STATIC_LOCK) { synchronized (STATIC_LOCK) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment