enough-match-43171
12/16/2025, 9:05 PMlkapi = api.LiveKitAPI()
await lkapi.egress.stop_egress(
api.StopEgressRequest(egress_id=self.egress_id)
)
await lkapi.aclose()
Is this correct way to close the egress ?
I get this error
2025-12-17 022240,821 - ERROR - Failed to stop egress recording: TwirpError(code=failed_precondition, message=egress with status EGRESS_COMPLETE cannot be stopped, status=412)tall-airline-16756
12/16/2025, 9:05 PMtall-airline-16756
12/16/2025, 9:05 PMEGRESS_ACTIVE or EGRESS_STARTING.
list_resp = await lkapi.egress.list_egress()
for e in list_resp.items:
if e.egress_id == self.egress_id:
if e.status in ["EGRESS_ACTIVE", "EGRESS_STARTING"]:
await lkapi.egress.stop_egress(api.StopEgressRequest(egress_id=self.egress_id))
else:
print(f"Egress already ended with status: {e.status}")
break
• Or catch the failed_precondition error and ignore it when the message indicates `EGRESS_COMPLETE`:
try:
await lkapi.egress.stop_egress(api.StopEgressRequest(egress_id=self.egress_id))
except Exception as err:
if "EGRESS_COMPLETE" in str(err) and "failed_precondition" in str(err):
print("Egress already completed; nothing to stop.")
else:
raise
• Best practice: stop egress proactively (for agent sessions) when the participant leaves or delete the room, or trigger stop via the participant_left webhook so you don't attempt stopping after completion.
If you want, share the egress status you see from list_egress() and I can suggest the exact next step.
Sources: Egress API | LiveKit docs | Quotas and limits | LiveKit docs | Webhooks | LiveKit docsenough-match-43171
12/16/2025, 9:11 PMtall-airline-16756
12/16/2025, 9:12 PMgrid-light) to use a white background. You can also build fully custom layouts by supplying a custom recording template (custom_base_url) and modifying the default templates.
Would you like examples of the layout names to pass in your egress request or guidance on creating a custom template?
Sources: RoomComposite Egress | LiveKit Docs | Custom recording templates | LiveKit docsenough-match-43171
12/16/2025, 9:12 PMtall-airline-16756
12/16/2025, 9:13 PMspeaker template (not a custom template that omits the carousel). If you use a custom custom_base_url, ensure it includes the non-speaker carousel logic (e.g., CarouselLayout).
• Confirm the egress/headless browser is seeing new participants. Start egress while multiple publishers are active, or test with multiple simulated publishers to verify dynamic updates.
• Inspect template logs/DOM in headless Chrome (add console logs in your template) to confirm non-speaking participant tracks are rendered.
Quick checks you can run now:
1. Use list_egress() or your app's view to confirm other participants are in the room and publishing video.
2. Start a test egress with the default speaker layout and multiple cameras to see expected behavior.
3. If using a custom template, share the template code for the participant rendering section and I can point out what to change.
Which of these would you like to try first, or do you want to paste your template's participant-rendering code?
Sources: RoomComposite Egress | LiveKit Docs | Custom recording templates | LiveKit docsenough-match-43171
12/16/2025, 9:13 PMtall-airline-16756
12/16/2025, 9:14 PMspeaker layout will show only that video feed. The speaker template displays participants that have active video tracks; audio‑only participants are not rendered in the video carousel.
Options to get the view you want:
• Enable video for other participants so they appear in the carousel.
• Use a custom template that renders audio‑only participants as avatars/placeholders (or shows their names) and include them in the carousel. You can modify the default template to add placeholder tiles for participants with no video.
• Use the grid layout (or grid-light) if you prefer a tiled view — it still requires video to show real video tiles, but a custom grid template can show placeholders for audio-only users.
If you want, I can:
• Show the specific part of the default template to modify to include audio-only placeholders, or
• Provide a small snippet that renders a placeholder tile when a participant has no video.
Which would you like?cuddly-cartoon-47334
12/27/2025, 10:28 PMtall-airline-16756
12/27/2025, 10:28 PMenough-match-43171
12/28/2025, 5:01 PMtall-airline-16756
12/28/2025, 5:01 PMcustom_base_url) that shows screen share plus placeholder tiles.
If you’d like, I can send a small snippet that renders placeholder tiles for audio-only users in the template — would you like that?