Handle avatar connect/disconnect events
Read this section if you experience any of the following issues:
- Empty room (user sees black screen)
- User gets no video or audio, but audio/text input are still active
- Avatar disappears
- Avatar is delayed in speaking
ParticipantConnected and ParticipantDisconnected events on the frontend to switch between your UI’s ringing, active, and finished states.
The ParticipantConnected event will fire when the LemonSlice avatar is ready and has joined the room. Use this to trigger the UI to show the active call.
The ParticipantDisconnected event will fire if the avatar leaves, which happens if the pipeline stops for any reason (normal call completion, idle timeout, upstream errors, etc.). Use this to leave the active call UI and disconnect from the room.
LiveKit users: You should also listen to these events on the backend and call
agent_session.generate_reply() when the LemonSlice avatar joins to prevent any idle time before the avatar speaks.ParticipantConnected event). Then, if the avatar ever leaves (signaled through the ParticipantDisconnected event), move to the inactive call UI to allow the user to rejoin the call.
Refer to our LiveKit agent quickstart example to see how these listeners can be registered on the backend. We provide a representative frontend snippet below:
JAVASCRIPT
Handle room errors
Read this section if you experience any of the following issues:
- Avatar fails to join a call
- Crashed calls. Avatar leaves the call or audio cuts out.
Disconnected events to handle any issues with the room. These can include network errors, WebRTC failures, or join failures.
JAVASCRIPT
Catch pipeline errors
Read this section if you experience any of the following issues:
- Avatar does not speak
- Session dies unexpectedly
err.recoverable == False should end the pipeline gracefully as the pipeline is now dead.
PYTHON
Handle startup failures
Read this section if you experience any of the following issues:
- The call never connects
JAVASCRIPT
Check timeouts
Read this section if you experience any of the following issues:
- Avatar suddenly exits a call
- Calls suddenly end after the same number of minutes
- LemonSlice idle timeout (default is 60 seconds). Resets when the avatar is talking.
- LemonSlice GPU timeout (default is 30 minutes. If you regularly have longer calls, please contact support@lemonslice.com)
- Third-party timeouts (e.g. LiveKit or ElevenLabs)
PYTHON
