The eleven labs action works well with the audio player showing up in chat window. The recent action updates have opened up possibilities! I want to use the free edge_tts library for simple audio narrations.
To show the audio player, you will have to save the mp3 file in the same directory where the script is running.
Example code (Eleven labs):
CHUNK_SIZE = 1024
res = requests.post(endpoint, json=data, headers=headers, timeout=30)
if res.status_code == 200:
with open('output.mp3', 'wb') as f:
for chunk in res.iter_content(chunk_size=CHUNK_SIZE):
if chunk:
f.write(chunk)