---
related_nodes: [relay_request]
---

# Relay Audio

Play an audio clip on the machine running Verdalia Relay.

One shared output stream: clips that overlap are mixed together, and the stream is released
as soon as nothing is playing.

## Configuration

**connection** — Verdalia Relay connection: pick one, or write a template such as
`{{ input.connection_id }}` that resolves to a connection id from `input` on each run. The node
fails, naming the template and what it resolved to, when the input has no value for it, the value
is not a connection id, no Verdalia Relay connection has that id, or that relay is offline.

**operation** — Operation to run:

- `play` — plays the clip on the `input` socket. `volume` is `0.0` to `2.0` (default `1.0`).
  With `wait_for_completion`, the node stays open until the clip finishes.
- `stop` — stops the clip named by `clip_id`, or every clip when it is empty. `clip_id`
  supports interpolation from `input`.
- `status` — what is playing right now.

A clip may be at most 5 minutes long and 16 MiB. Supported formats are mp3, wav, flac,
ogg/vorbis, and m4a/aac. Opus and raw PCM are refused — so a Generate Speech node feeding
this one must not be set to an Opus output format.

## Inputs

**input** — for `play`, the clip: binary data, a `{binary, filename, content_type}` object,
or an `{object_id}` media reference. For `stop` and `status`, the interpolation context.

## Output

**output** — the result of the chosen operation. A failure fails the node.

`play`:

```json
{ "clip_id": "V1StGXR8_Z", "duration_secs": 12.5, "active_clips": 1 }
```

`duration_secs` is null when the clip's container declares no length. With
`wait_for_completion`, a `wait_timed_out` boolean is also present: `true` means the wait ran
out before the Relay stopped reporting the clip. The clip played either way.

`stop`:

```json
{ "stopped": 1, "active_clips": 0 }
```

`status`:

```json
{
  "stream_open": true,
  "active_clips": [
    {
      "clip_id": "V1StGXR8_Z",
      "content_type": "audio/mpeg",
      "bytes": 204800,
      "elapsed_secs": 3.2,
      "duration_secs": 12.5
    }
  ]
}
```

