Hello, Egress is recording on a deleted room. I c...
# ask-ai
a
Hello, Egress is recording on a deleted room. I cannot see any participants in the room apart from the Egress subscriber. It’s going on for last 2 hours When I try to delete room using the Livekit API says room does not exist. And when I try to remove the participant it says participant not found. Please help me fix this.
t
Thanks for reaching out, Mehul. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Let's work together to resolve the issue of egress recording on a deleted room. Here’s a simple step-by-step guide to help you through it: 1. Stop the Egress Recording: Please use the Egress Service to manually stop the ongoing recording. This step is important because the room deletion might be blocked if the egress is still active. 2. Delete the Room: After stopping the egress, you can use the
DeleteRoom
API to delete the room. This will disconnect all participants and stop any remaining egress processes. 3. Remove a Participant: If you need to remove specific participants, the
RemoveParticipant
API is available for that. Make sure you have the right permissions, like
roomCreate
for deleting a room and
roomAdmin
for removing participants. If you find that the room still can’t be deleted, double-check that it exists in the room store and isn’t just an RTC context issue. If you run into any more challenges or have questions, please don’t hesitate to reach out—I’m here to help! Sources: lib/livekit/room_service_client.rb | protobufs/livekit_analytics.proto | pkg/service/roommanager.go
a
How to stop egresss? Can you give me python code?
t
Here’s a helpful example of Python code to stop an egress recording in LiveKit. I hope this makes the process a bit easier for you:
Copy code
from livekit import api

# Initialize the LiveKit API client
# Don’t forget to replace these with your actual API key, secret, and LiveKit server URL
livekit_api = api.LiveKitAPI(
    url="https://your-livekit-server-url",
    api_key="your-api-key",
    api_secret="your-api-secret"
)

# Call stop_egress with the specific egress_id
egress_id = "your-egress-id"  # Make sure to use the actual egress ID here
try:
    egress_info = livekit_api.egress.stop_egress(
        api.StopEgressRequest(egress_id=egress_id)
    )
    print(f"Egress {egress_id} stopped successfully.")
    print(egress_info)
except Exception as e:
    print(f"Failed to stop egress: {e}")
Just replace
your-livekit-server-url
,
your-api-key
,
your-api-secret
, and
your-egress-id
with your actual LiveKit server details and the ID of the egress you want to stop. If you’re unsure how to find the egress ID or if you have any other questions, please don’t hesitate to reach out—I’m here to help! Sources: livekit-protocol/livekit/protocol/egress.pyi | app/api/record/stop/route.ts | Egress API | LiveKit Docs
a
Got this response: Failed to stop egress: TwirpError(code=failed_precondition, message=egress with status EGRESS_COMPLETE cannot be stopped, status=412)
t
It looks like the error is telling us that the egress process has already finished, so it can’t be stopped at this point. The
StopEgress
operation works only when the egress is in the
EGRESS_STARTING
or
EGRESS_ACTIVE
states. Here’s a friendly step-by-step to help you out: 1. Check the Egress Status: You can use the
ListEgress
or
GetEgress
API to see where things stand. If it shows
EGRESS_COMPLETE
, that means the process has wrapped up. 2. Work with Completed Egress: When it’s complete, you can grab the output details like the file location or stream info to use as needed, instead of trying to stop it. 3. Avoid Duplicate Stop Requests: It’s a good idea to have your application check the egress status before sending a stop command, so you don’t run into this error again. If you’d like a hand with checking the egress status or managing the output, just let me know—I’m here to help! Sources: pkg/service/egress.go | livekit/livekit_egress.pb.go
a
But the frontend dashboard is showing that the egress is active
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
a
Give me python code to get egress info