Discussions

Ask a Question
Back to All

Pending_url shown when creating and retrieving talk by id

Dear D-ID support,


I have followed the API documentation with regards to creating an idle video and here is the code I am using

async function createIdleVideo(source) {
    const sessionResponse = await fetchWithRetries(`${DID_API.url}/talks`, {
      method: "POST",
      headers: {
        Authorization: `Basic ${DID_API.key}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        source_url: source,
        driver_url: "bank://lively/driver-06",
        script: {
          type: "text",
          ssml: true,
          input:
            '<break time="5000ms"/><break time="5000ms"/><break time="5000ms"/>',
          provider: {
            type: "microsoft",
            voice_id: "en-US-JennyNeural",
          },
        },
        config: {
          fluent: true,
        },
      }),
    }).then((res) => res.json());

    let talkID = sessionResponse.id;

    console.log("before wait");
    await new Promise(resolve => setTimeout(resolve, 2000));
    console.log("after wait");

    const idleVidURL = await fetchWithRetries(
      `${DID_API.url}/talks/${talkID}`,
      {
        method: "GET",
        headers: {
          accept: "application/json",
          authorization:
            `Basic ${DID_API.key}`,
        },
      },
      3
    ).then(res => res.json());

    console.log("IdleVideoURL")
    console.log(idleVidURL);

    return idleVidURL.result_url;
  }

I have already tried setting a timeout in between sending the creation request and the get request in case of server lag.

This is my console log when I log the idleVidURL. I am currently on a paid account so I assume there should be priority queue?

Any assistance would be greatly appreciated!