# ai.newnal.illi.artwork.recordPlayback

> Device app. Records a playback event of a delivered work: started (clears the unplayed state), paused (with the position the viewer can resume from) and completed. Playback is independent of delivery and is never an acknowledgement. Events are idempotent by eventKey within the delivery; the server keeps the latest paused position.

- Kind: procedure
- Authority: artwork.illi.newnal.ai
- Lexicon: 1
- Published by [illi-service.newnal.id](https://lexicon.garden/identity/did:plc:uztm7bi2ce42dez3uu3qafro), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:uztm7bi2ce42dez3uu3qafro/ai.newnal.illi.artwork.recordPlayback)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:uztm7bi2ce42dez3uu3qafro/ai.newnal.illi.artwork.recordPlayback/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:uztm7bi2ce42dez3uu3qafro/ai.newnal.illi.artwork.recordPlayback/analytics)

## Procedure (`ai.newnal.illi.artwork.recordPlayback`)

Type: procedure · POST

### Input (application/json)

- `deliveryId` (string, required)
  - Constraints: maxLength: 64
- `event` (string, required)
  - Constraints: knownValues: started | paused | completed
- `eventKey` (string, required)
  - Constraints: minLength: 1, maxLength: 64
- `homeId` (string · tid, required)
- `occurredAt` (string · datetime, required)
- `positionMs` (integer, required)
  - Constraints: minimum: 0

### Output (application/json)

- `lastPositionMs` (integer, required)
  - Constraints: minimum: 0
- `playbackState` (string, required)
  - Constraints: knownValues: unplayed | inProgress | paused | completed
- `recorded` (boolean, required)

### Errors

- `NotMember`: No description in schema.
- `DeliveryNotFound`: No description in schema.
- `NotDevice`: No description in schema.
- `DeliveryWithdrawn`: No description in schema.
- `RequestConflict`: No description in schema.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Device app. Records a playback event of a delivered work: started (clears the unplayed state), paused (with the position the viewer can resume from) and completed. Playback is independent of delivery and is never an acknowledgement. Events are idempotent by eventKey within the delivery; the server keeps the latest paused position.",
      "errors": [
        {
          "name": "NotMember"
        },
        {
          "name": "DeliveryNotFound"
        },
        {
          "name": "NotDevice"
        },
        {
          "name": "DeliveryWithdrawn"
        },
        {
          "name": "RequestConflict"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "deliveryId": {
              "maxLength": 64,
              "type": "string"
            },
            "event": {
              "knownValues": [
                "started",
                "paused",
                "completed"
              ],
              "type": "string"
            },
            "eventKey": {
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            },
            "homeId": {
              "format": "tid",
              "type": "string"
            },
            "occurredAt": {
              "format": "datetime",
              "type": "string"
            },
            "positionMs": {
              "minimum": 0,
              "type": "integer"
            }
          },
          "required": [
            "homeId",
            "deliveryId",
            "event",
            "positionMs",
            "occurredAt",
            "eventKey"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "lastPositionMs": {
              "minimum": 0,
              "type": "integer"
            },
            "playbackState": {
              "knownValues": [
                "unplayed",
                "inProgress",
                "paused",
                "completed"
              ],
              "type": "string"
            },
            "recorded": {
              "type": "boolean"
            }
          },
          "required": [
            "recorded",
            "playbackState",
            "lastPositionMs"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "ai.newnal.illi.artwork.recordPlayback",
  "lexicon": 1
}
```
