Discussions

Ask a Question
Back to All

How to use the request_url inside the video HTML element as src?

When I send a POST request to the talks endpoint, I receive the following URL as the request_url:

URL: https://d-id-talks-prod.s3.us-west-2.amazonaws.com/google-oauth2%7C106701550512364286929/tlk_BaOXF_uIIw9zWyfbd7EO0/1736953753674.mp4?AWSAccessKeyId=AKIA5CUMPJBIK65W6FGA&Expires=1737040160&Signature=hZ7FZVPPAkPzHsByDjyCqbJDsAY%3D

I cannot directly use this URL as the src of the HTML element. How can I change my request so that the URL I receive is directly usable or at least tell me how to fetch the video from the URL and store it?

async uploadVideoFromUrl(requestUrl: string): Promise<string | void> {
try {
// Step 1: Fetch the video from the request URL
const response = await fetch(requestUrl);
const blob: Blob = await response.blob();
..............the rest of the code to extract the blob as mp4 and store it in the storage
}

But the fetch fails and exits the try block, and directly goes to the catch error.