Discussions
Creating Streaming Talk Python
2 months ago by ndorado
Hello everyone, i am trying to build a Virtual Interactive Agent using python. Actually i am following the 4 steps guide in the "Talk Streams" section of the documentation. I have this issue in the step 4 "Create a talk stream" it returns me the status "started" and a video id. But when i try to see the created video in the AWS Bucket, it is empty his size is 1.0 B. This is my code for the new stream creation:
async def create_talk_stream(stream_id, session_id_last):
url = f"https://api.d-id.com/talks/streams/{stream_id}"
# Define el bucket y el archivo
bucket_name = 'datapills' # Cambia esto por el nombre de tu bucket
carpeta = 'iface' # Cambia esto por la carpeta que tienes en tu bucket
archivo_destino = 'movie.mp4' # El nombre del archivo que se guardará
#result_url = "https://datapills.s3.us-east-2.amazonaws.com/iface/video.mp4"
payload = {
"session_id": session_id_last, # Usa el último session_id
"result_url": "https://datapills.s3.us-east-2.amazonaws.com/iface/movie2.mp4", # URL para guardar el resultado
"script": {
"type": "text",
"provider": {
"type": "microsoft",
"voice_id": "Sara"
},
"input": "Video demo de el codigo Iface?",
"ssml": False
},
"audio_optimization": 2,
"name": "AsistenteVirtualDemo",
"config": {
"fluent": False,
"pad_audio": 0.0
}
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": "Basic Ym1SdmNtRmtiMEIxWVc0dVpXUjFMbU52OnJmMUo2VGtLUEZQcElfX3k4Y2hnSA=="
}
response = requests.post(url, json=payload, headers=headers)
# Muestra la respuesta para verificar si se creó correctamente el "talk stream"
print("Código de estado:", response.status_code)
print("Respuesta del servidor:", response.json())
I am using the session id obtained after send the ICE candidates...
Thankyou !!