probably non-pythonic exception handling in 01
This commit is contained in:
@@ -44,19 +44,22 @@ async def main(room_url):
|
|||||||
@transport.event_handler("on_participant_joined")
|
@transport.event_handler("on_participant_joined")
|
||||||
async def on_participant_joined(transport, participant):
|
async def on_participant_joined(transport, participant):
|
||||||
nonlocal tts
|
nonlocal tts
|
||||||
if participant["info"]["isLocal"]:
|
try:
|
||||||
return
|
if participant["info"]["isLocal"]:
|
||||||
|
return
|
||||||
|
|
||||||
await tts.say(
|
await tts.say(
|
||||||
"Hello there, " + participant["info"]["userName"] + "!",
|
"Hello there, " + participant["info"]["userName"] + "!",
|
||||||
transport.send_queue,
|
transport.send_queue,
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
print("Exception while speaking:", e)
|
||||||
|
|
||||||
# wait for the output queue to be empty, then leave the meeting
|
# wait for the output queue to be empty, then leave the meeting
|
||||||
await transport.stop_when_done()
|
await transport.stop_when_done()
|
||||||
|
|
||||||
await transport.run()
|
await transport.run()
|
||||||
del(tts)
|
del (tts)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user