apiVersion: capsule.dev/v0.1
kind: Capsule
name: lkmeet-livekit-recording-api
version: 0.1.0
type: subsystem
purpose:
summary: 'Provides backend API endpoints to start and stop LiveKit room recordings.
It integrates with LiveKit''s Egress functionality to capture room content and
store it in an S3-compatible bucket.
'
owns:
- API endpoints for recording control
- LiveKit Egress client integration
does_not_own:
- Client-side UI for recording control
- S3 bucket management
interfaces:
provides:
- kind: http_api
name: /api/record/start
description: Endpoint to start recording a LiveKit room.
- kind: http_api
name: /api/record/stop
description: Endpoint to stop recording a LiveKit room.
agent:
summary_for_ai: 'This capsule consists of Next.js API routes for LiveKit Egress
control. It uses `livekit-server-sdk` to interact with the LiveKit server and
S3 for storage. Implement robust error handling and ensure environment variables
are correctly configured for S3 and LiveKit. Pay close attention to the security
warning regarding lack of authentication.
'
avoid:
- Do not introduce user authentication logic within this capsule; it's explicitly
noted as a simplification for the example.
verification:
invariants:
- Requires valid LiveKit and S3 credentials to operate.
- Recording cannot start if a recording is already active for the room.
- Recording stops all active egresses for a given room.
x-reuse:
notes: 'The recording endpoints explicitly state: ''DO NOT USE THIS FOR PRODUCTION
PURPOSES AS IS'' due to a lack of user authentication. This is a critical point
for reuse. The S3 configuration (endpoint, region, bucket) and the `filepath`
format for recordings (`${new Date(Date.now()).toISOString()}-${roomName}.mp4`)
are hardcoded and will need to be parameterized. The `layout: ''speaker''` for
`startRoomCompositeEgress` is also hardcoded.
'
x-reconstruct:
install: install.json