add on_first_other_participant_joined event

This commit is contained in:
Moishe Lettvin
2024-01-12 08:39:56 -05:00
parent 37207745c9
commit ec1f2362c5
3 changed files with 11 additions and 12 deletions

View File

@@ -34,14 +34,8 @@ async def main(room_url):
llm_task = asyncio.create_task(llm.run())
has_joined = False
@transport.event_handler("on_participant_joined")
async def on_participant_joined(transport, participant):
nonlocal has_joined
if participant["id"] == transport.my_participant_id or has_joined:
return
has_joined = True
@transport.event_handler("on_first_other_participant_joined")
async def on_first_other_participant_joined(transport):
await asyncio.gather(llm_task, tts.run())
# wait for the output queue to be empty, then leave the meeting