# Server Audio Recording API This API lets Unity keep local video recording while the server records app audio as an extra WebRTC peer. When Unity stops local recording, upload the local video to the stop endpoint and the server merges it with the recorded audio. ## 1. Start `POST /api/server-audio-recordings/start` Body: ```json { "meetingId": "room-001", "offerSdp": "v=0...", "iceServers": [] } ``` Response: ```json { "success": true, "recordingId": "uuid", "meetingId": "room-001", "answerSdp": "v=0...", "candidates": [] } ``` Unity should create a peer connection with an audio track only, send its offer SDP here, then set the returned answer SDP as the remote description. ## 2. Trickle ICE `POST /api/server-audio-recordings/{recordingId}/candidate` Body: ```json { "candidate": "candidate:...", "sdpMid": "0", "sdpMLineIndex": 0 } ``` ## 3. Stop And Merge `POST /api/server-audio-recordings/{recordingId}/stop` Content type: `multipart/form-data` Fields: - `video`: the local video file recorded by Unity. - `meetingId`: optional, overrides the start meeting id. - `filename`: optional display filename. - `userId`: optional host user id. - `host`: optional JSON host metadata. - `participants`: optional JSON participant metadata array. Response: ```json { "success": true, "recordingId": "uuid", "meetingId": "room-001", "filename": "2026-06-02T13-00-00-000Z-uuid.mp4", "merged": true, "url": "/api/recordings/room-001/2026-06-02T13-00-00-000Z-uuid.mp4/download" } ``` The server keeps the local video track, replaces audio with the server-recorded app audio, and stores the merged file in the existing `recordings` directory. ## 4. Cancel `DELETE /api/server-audio-recordings/{recordingId}` Use this if local recording is aborted and no merged output should be saved.