# Smart Home MediaState Trait Schema

`action.devices.traits.MediaState` - This trait is used for devices which are able to report media states.

The `MediaState` trait is used by the Assistant for these purposes:

- To know what's playing on each device, whether or not playback was initiated by the Assistant. This information helps the Assistant better understand user intents. For example, users will say *"Pause the Tonight Show"* when their actual intent is *"Pause the device currently playing the Tonight Show'*.
- For portability between media players---if the Assistant knows what's playing and the position of current playback, the Assistant can transfer that playback to another device as a user moves between rooms, or save the playback for later on an arbitrary device.

You can specify what level and aspect of media states your solution provides by
configuring the attributes in this trait. This trait is typically used together with the
[`TransportControl`](https://developers.home.google.com/cloud-to-cloud/traits/transportcontrol) traits

> [!NOTE]
> **Note:** We strongly recommend that you push the media states to Google proactively using the [ReportState API](https://developers.home.google.com/cloud-to-cloud/integration/report-state). This will improve the Assistant's contextual understanding and target ranking (for example, select the active TV for *"Pause"*).

## Device ATTRIBUTES

Devices with this trait may report the following
attributes as part of the [`SYNC`](https://developers.home.google.com/cloud-to-cloud/intents/sync) operation. To learn
more about handling `SYNC` intents, see
[Intent fulfillment](https://developers.home.google.com/cloud-to-cloud/integration/sync).

| Attributes | Type | Description |
|---|---|---|
| `supportActivityState` | *Boolean* | (Default: `false`) Indicate if the device can report the activity state. |
| `supportPlaybackState` | *Boolean* | (Default: `false`) Indicate if the device can report the current playback state. |

#### Examples

*Media device that reports both activity and playback state for SYNC response*

```
{
  "supportActivityState": true,
  "supportPlaybackState": true
}
```

## Device STATES

Entities with this trait may report the following
states as part of the [`QUERY`](https://developers.home.google.com/cloud-to-cloud/intents/query) operation. To learn
more about handling `QUERY` intents, see
[Intent fulfillment](https://developers.home.google.com/cloud-to-cloud/integration/query-execute).

| States | Type | Description |
|---|---|---|
| `activityState` | *String* | Indicate whether the device is active and the user is actively interacting with it. Supported values: `INACTIVE` `STANDBY` `ACTIVE` |
| `playbackState` | *String* | Indicate the current state when playing media. Supported values: `PAUSED` `PLAYING` `FAST_FORWARDING` `REWINDING` `BUFFERING` `STOPPED` |

#### Examples

*Media device that reports both activity and playback state*

```
{
  "activityState": "ACTIVE",
  "playbackState": "PAUSED"
}
```

## Device COMMANDS

None.

## Device ERRORS

See the full list of [errors and exceptions](https://developers.home.google.com/cloud-to-cloud/intents/errors-exceptions).