make destructor call client.close in PlayHT service
This commit is contained in:
@@ -31,7 +31,7 @@ class PlayHTAIService(TTSService):
|
|||||||
quality="higher",
|
quality="higher",
|
||||||
format=Format.FORMAT_WAV)
|
format=Format.FORMAT_WAV)
|
||||||
|
|
||||||
def close(self):
|
def __del__(self):
|
||||||
self.client.close()
|
self.client.close()
|
||||||
|
|
||||||
async def run_tts(self, sentence):
|
async def run_tts(self, sentence):
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ async def main(room_url):
|
|||||||
meeting_duration_minutes,
|
meeting_duration_minutes,
|
||||||
mic_enabled=True
|
mic_enabled=True
|
||||||
)
|
)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
tts = ElevenLabsTTSService(
|
tts = ElevenLabsTTSService(
|
||||||
aiohttp_session=session,
|
aiohttp_session=session,
|
||||||
@@ -42,6 +43,7 @@ async def main(room_url):
|
|||||||
# Register an event handler so we can play the audio when the participant joins.
|
# Register an event handler so we can play the audio when the participant joins.
|
||||||
@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
|
||||||
if participant["info"]["isLocal"]:
|
if participant["info"]["isLocal"]:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -54,6 +56,7 @@ async def main(room_url):
|
|||||||
await transport.stop_when_done()
|
await transport.stop_when_done()
|
||||||
|
|
||||||
await transport.run()
|
await transport.run()
|
||||||
|
del(tts)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user