Skip to content

File Playback

endpoint.create_with_file

Create a send-only endpoint that plays audio from a local file or URL.

json
{
  "id": "1",
  "method": "endpoint.create_with_file",
  "params": {
    "source": "/path/to/audio.wav",
    "start_ms": 0,
    "loop_count": 0,
    "cache_ttl_secs": 300,
    "shared": false,
    "timeout_ms": 10000
  }
}
ParamTypeDefaultDescription
sourcestringrequiredFile path or HTTP(S) URL
start_msu640Start playback at this position
loop_countu32 or null0Number of additional replays: 0 = play once, 1 = play twice, null = loop infinitely. Maximum: 10000
cache_ttl_secsu32300For URLs: cache lifetime in seconds. 0 = delete after use
sharedboolfalseShare decode pipeline across sessions
timeout_msu3210000Max milliseconds to wait for download (URL sources only; ignored for local files). Min: 1, max: 60000

Supported formats: WAV, MP3, OGG/Vorbis, FLAC.

File endpoints are always send-only — they produce audio but don't receive it.

endpoint.file.seek

Seek to a position in the file.

json
{"id":"2","method":"endpoint.file.seek","params":{"endpoint_id":"...","position_ms":5000}}

endpoint.file.pause / resume

json
{"id":"3","method":"endpoint.file.pause","params":{"endpoint_id":"..."}}
{"id":"4","method":"endpoint.file.resume","params":{"endpoint_id":"..."}}

Events

endpoint.file.finished

Emitted when playback completes (all loops done) or encounters an error.

json
{
  "event": "endpoint.file.finished",
  "data": {
    "endpoint_id": "...",
    "reason": "completed",
    "error": null
  }
}

reason is "completed" or "error". If "error", the error field contains the message.