Commit a533d819 by sungsoo Committed by Christos Tsilopoulos

Add a method to distinguish whether a player can be set by MediaSession

PiperOrigin-RevId: 388835913
parent 7375fe31
......@@ -89,6 +89,16 @@ public abstract class BasePlayer implements Player {
return getAvailableCommands().contains(command);
}
/**
* {@inheritDoc}
*
* <p>BasePlayer and its descendents will return {@code true}.
*/
@Override
public final boolean canAdvertiseSession() {
return true;
}
@Override
public final void play() {
setPlayWhenReady(true);
......
......@@ -152,6 +152,11 @@ public class ForwardingPlayer implements Player {
}
@Override
public boolean canAdvertiseSession() {
return player.canAdvertiseSession();
}
@Override
public Commands getAvailableCommands() {
return player.getAvailableCommands();
}
......
......@@ -1543,6 +1543,9 @@ public interface Player {
*/
boolean isCommandAvailable(@Command int command);
/** Returns whether the player can be used to advertise a media session. */
boolean canAdvertiseSession();
/**
* Returns the player's currently available {@link Commands}.
*
......
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