# Player.Commands

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/Player.java+class:androidx.media3.common.Player.Commands)

*** ** * ** ***


```
public final class Player.Commands
```

<br />

*** ** * ** ***

A set of `https://developer.android.com/reference/androidx/media3/common/Player.Command`.

Instances are immutable.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi public final class https://developer.android.com/reference/androidx/media3/common/Player.Commands.Builder` A builder for `https://developer.android.com/reference/androidx/media3/common/Player.Commands` instances. |

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/androidx/media3/common/Player.Commands` | `https://developer.android.com/reference/androidx/media3/common/Player.Commands#EMPTY()` An empty set of commands. |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Commands.Builder` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Player.Commands#buildUpon()()` Returns a `https://developer.android.com/reference/androidx/media3/common/Player.Commands.Builder` initialized with the values of this instance. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/Player.Commands#contains(int)(@https://developer.android.com/reference/androidx/media3/common/Player.Command int command)` Returns whether the set of commands contains the specified `https://developer.android.com/reference/androidx/media3/common/Player.Command`. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/Player.Commands#containsAny(int...)(@https://developer.android.com/reference/androidx/media3/common/Player.Command int[] commands)` Returns whether the set of commands contains at least one of the given `commands`. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/Player.Commands#equals(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html obj)` |
| `static https://developer.android.com/reference/androidx/media3/common/Player.Commands` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Player.Commands#fromBundle(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html bundle)` Restores a `Commands` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `int` | `@https://developer.android.com/reference/androidx/media3/common/Player.Command https://developer.android.com/reference/androidx/media3/common/Player.Commands#get(int)(int index)` Returns the `https://developer.android.com/reference/androidx/media3/common/Player.Command` at the given index. |
| `int` | `https://developer.android.com/reference/androidx/media3/common/Player.Commands#hashCode()()` |
| `int` | `https://developer.android.com/reference/androidx/media3/common/Player.Commands#size()()` Returns the number of commands in this set. |
| `https://developer.android.com/reference/android/os/Bundle.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Player.Commands#toBundle()()` |

## Constants

### EMPTY

```
public static final Player.Commands EMPTY
```

An empty set of commands.

## Public methods

### buildUpon

```
@UnstableApi
public Player.Commands.Builder buildUpon()
```

Returns a `https://developer.android.com/reference/androidx/media3/common/Player.Commands.Builder` initialized with the values of this instance.

### contains

```
public boolean contains(@Player.Command int command)
```

Returns whether the set of commands contains the specified `https://developer.android.com/reference/androidx/media3/common/Player.Command`.

### containsAny

```
public boolean containsAny(@Player.Command int[] commands)
```

Returns whether the set of commands contains at least one of the given `commands`.

### equals

```
public boolean equals(@Nullable Object obj)
```

### fromBundle

```
@UnstableApi
public static Player.Commands fromBundle(Bundle bundle)
```

Restores a `Commands` from a `https://developer.android.com/reference/android/os/Bundle.html`.

### get

```
@Player.Command
public int get(int index)
```

Returns the `https://developer.android.com/reference/androidx/media3/common/Player.Command` at the given index.

| Parameters |
|---|---|
| `int index` | The index. Must be between 0 (inclusive) and `https://developer.android.com/reference/androidx/media3/common/Player.Commands#size()` (exclusive). |

| Returns |
|---|---|
| `int` | The `https://developer.android.com/reference/androidx/media3/common/Player.Command` at the given index. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IndexOutOfBoundsException.html` | If index is outside the allowed range. |

### hashCode

```
public int hashCode()
```

### size

```
public int size()
```

Returns the number of commands in this set.

### toBundle

```
@UnstableApi
public Bundle toBundle()
```