Discussions

Ask a Question
Back to All

Streaming Live Demo by D-ID

I downloaded Streaming Live Demo by D-ID repo and used 'talks' and I served some audio files to be sent to the avatar to be played with lip sync using

await streamAudioInChunks(`http://mysite.local:8080/sound/idle0`);

but when its played it comes out as a noisy sound i cant hear any audio, however the audio file on my local laptop works fine and when hosted on the server still works fine and clear, but i think the problem relies in the place where this audio is formatted to a stream message and sent along to you with the API key:

  const streamMessage = {
    type: 'stream-audio',
    payload: {
      script: {
        type: 'audio',
        input: Array.from(chunk),
      },
      config: {
        stitch: true,
      },
      background: {
        color: '#FFFFFF',
      },
      session_id: sessionId,
      stream_id: streamId,
      presenter_type: PRESENTER_TYPE,
    },
  };
function sendMessage(ws, message) {
  if (ws.readyState === WebSocket.OPEN) {
    ws.send(JSON.stringify(message));
  } else {
    console.error('WebSocket is not open. Cannot send message.');
  }
}

what do you suggest might be the problem? It was working fine a week ago but now not working suddenly with the same audio files!
I thought the problem was with the API key so i subscribed to higher plan but still problem not solved.
Note that all the code snippets i attached are from https://github.com/de-id/live-streaming-demo in streaming-client-api-ws file.