# Smart Home TransportControl Trait Schema

`action.devices.traits.TransportControl` - This trait is used for devices which are able to control media playback (for example, resuming music while it is paused).

## 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 |
|---|---|---|
| `transportControlSupportedCommands` | *Array* | **Required.** A list of strings describing supported transport control commands on this device. |
| `[*item, ...*]` | *String* | Supported commands. Supported values: `CAPTION_CONTROL` `NEXT` `PAUSE` `PREVIOUS` `RESUME` `SEEK_RELATIVE` `SEEK_TO_POSITION` `SET_REPEAT` `SHUFFLE` `STOP` |

#### Examples

*Device supporting playback commands*

```
{
  "transportControlSupportedCommands": [
    "NEXT",
    "PREVIOUS",
    "PAUSE",
    "STOP",
    "RESUME"
  ]
}
```

## Device STATES

> [!NOTE]
> **Note:** If the device can store or report device state information, it should do so using the [`MediaState`](https://developers.home.google.com/cloud-to-cloud/traits/mediastate) trait.

None.

## Device COMMANDS

Devices with this trait may respond to the following
commands as part of the [`EXECUTE`](https://developers.home.google.com/cloud-to-cloud/intents/execute) operation. To learn
more about handling `EXECUTE` intents, see
[Intent fulfillment](https://developers.home.google.com/cloud-to-cloud/integration/query-execute#handle_execute_intents).

### `action.devices.commands.mediaStop`

Pause media playback.
This command requires the following attributes:

```
{
  "transportControlSupportedCommands": [
    "STOP"
  ]
}
```

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| No properties |||

#### Examples

*No parameters*

```
{
  "command": "action.devices.commands.mediaStop",
  "params": {}
}
```

### `action.devices.commands.mediaNext`

Skip to next media item.
This command requires the following attributes:

```
{
  "transportControlSupportedCommands": [
    "NEXT"
  ]
}
```

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| No properties |||

#### Examples

*No parameters*

```
{
  "command": "action.devices.commands.mediaNext",
  "params": {}
}
```

### `action.devices.commands.mediaPrevious`

Skip to previous media item.
This command requires the following attributes:

```
{
  "transportControlSupportedCommands": [
    "PREVIOUS"
  ]
}
```

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| No properties |||

#### Examples

*No parameters*

```
{
  "command": "action.devices.commands.mediaPrevious",
  "params": {}
}
```

### `action.devices.commands.mediaPause`

Pause media playback.
This command requires the following attributes:

```
{
  "transportControlSupportedCommands": [
    "PAUSE"
  ]
}
```

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| No properties |||

#### Examples

*No parameters*

```
{
  "command": "action.devices.commands.mediaPause",
  "params": {}
}
```

### `action.devices.commands.mediaResume`

Resume media playback.
This command requires the following attributes:

```
{
  "transportControlSupportedCommands": [
    "RESUME"
  ]
}
```

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| No properties |||

#### Examples

*No parameters*

```
{
  "command": "action.devices.commands.mediaResume",
  "params": {}
}
```

### `action.devices.commands.mediaSeekRelative`

Seek to a relative position.
This command requires the following attributes:

```
{
  "transportControlSupportedCommands": [
    "SEEK_RELATIVE"
  ]
}
```

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| `relativePositionMs` | *Integer* | **Required.** Milliseconds of the forward (positive int) or backward (negative int) amount to seek. |

#### Examples

*Seek 10s forward*

```
{
  "command": "action.devices.commands.mediaSeekRelative",
  "params": {
    "relativePositionMs": 10000
  }
}
```

*Seek 10s backward*

```
{
  "command": "action.devices.commands.mediaSeekRelative",
  "params": {
    "relativePositionMs": -10000
  }
}
```

### `action.devices.commands.mediaSeekToPosition`

Seek to an absolute position.
This command requires the following attributes:

```
{
  "transportControlSupportedCommands": [
    "SEEK_TO_POSITION"
  ]
}
```

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| `absPositionMs` | *Integer* | **Required.** Millisecond of the absolute position to seek to. |

#### Examples

*Seek to 30s*

```
{
  "command": "action.devices.commands.mediaSeekToPosition",
  "params": {
    "absPositionMs": 30000
  }
}
```

### `action.devices.commands.mediaRepeatMode`

Set repeat playback mode.
This command requires the following attributes:

```
{
  "transportControlSupportedCommands": [
    "SET_REPEAT"
  ]
}
```

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| `isOn` | *Boolean* | **Required.** True to turn on repeat mode, false to turn off repeat mode. |
| `isSingle` | *Boolean* | (Default: `false`) If specified, true means turning on single-item repeat mode, false means turning on normal repeat mode (for example a playlist). |

#### Examples

*Repeat on*

```
{
  "command": "action.devices.commands.mediaRepeatMode",
  "params": {
    "isOn": true
  }
}
```

*Repeat off*

```
{
  "command": "action.devices.commands.mediaRepeatMode",
  "params": {
    "isOn": false
  }
}
```

*Repeat a single track*

```
{
  "command": "action.devices.commands.mediaRepeatMode",
  "params": {
    "isOn": true,
    "isSingle": true
  }
}
```

### `action.devices.commands.mediaShuffle`

Shuffle the current playlist.
This command requires the following attributes:

```
{
  "transportControlSupportedCommands": [
    "SHUFFLE"
  ]
}
```

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| No properties |||

#### Examples

*No parameters*

```
{
  "command": "action.devices.commands.mediaShuffle",
  "params": {}
}
```

### `action.devices.commands.mediaClosedCaptioningOn`

Turn captions on.
This command requires the following attributes:

```
{
  "transportControlSupportedCommands": [
    "CAPTION_CONTROL"
  ]
}
```

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| `closedCaptioningLanguage` | *String* | Language or locale for closed captioning. |
| `userQueryLanguage` | *String* | Language or locale for user query. |

#### Examples

*Turn on closed captioning in English*

```
{
  "command": "action.devices.commands.mediaClosedCaptioningOn",
  "params": {
    "closedCaptioningLanguage": "en"
  }
}
```

*Turn on closed captioning in Korean*

```
{
  "command": "action.devices.commands.mediaClosedCaptioningOn",
  "params": {
    "closedCaptioningLanguage": "ko-KR"
  }
}
```

*Turn on closed captioning in Korean with user query in American English*

```
{
  "command": "action.devices.commands.mediaClosedCaptioningOn",
  "params": {
    "closedCaptioningLanguage": "ko-KR",
    "userQueryLanguage": "en-US"
  }
}
```

### `action.devices.commands.mediaClosedCaptioningOff`

Turn captions off.
This command requires the following attributes:

```
{
  "transportControlSupportedCommands": [
    "CAPTION_CONTROL"
  ]
}
```

#### Parameters

| Parameters | Type | Description |
|---|---|---|
| No properties |||

#### Examples

*Turn off closed captioning*

```
{
  "command": "action.devices.commands.mediaClosedCaptioningOff",
  "params": {}
}
```

## Device ERRORS

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