When cloud recording ends download

Currently, when you stop a cloud recording it saves to the dashboard (fine). However, once a user presses stop recording I would like the Cloud Recording to download. Is this possible?

Tagged:

Answers

  • Hi Reece!

    If you add a listener for the recording-stopped event, you can trigger a server-side flow that generates an access link for a user.

    Be sure to avoid generating the access link from the local client, to avoid exposing your domain's API key.

    If you're storing recordings on your own S3 bucket, you can do something similar. However, instead of Daily's REST API, you'll need to interact with the S3 API directly to allow a user to download the recording.

  • @daily_joey I currently have some JS code below... however I'm not sure how to find the recording id. It logs it in the console but I'm not sure how to get it

    var myHeaders = new Headers();

    myHeaders.append("Content-Type", "application/json");

    myHeaders.append("Authorization", "Bearer PRIVATE_KEY");


    var requestOptions = {

      method: 'GET',

      headers: myHeaders,

      redirect: 'follow'

    };


    fetch("https://api.daily.co/v1/recordings/ID HERE/access-link?valid_for_secs=8640000", requestOptions)

      .then(response => response.text())

      .then(result => console.log(result))

      .catch(error => console.log('error', error));

  • Looks like you will also need a listener for the recording-started event, so you can grab the recording ID for downloading later: https://docs.daily.co/reference/daily-js/events/recording-events#recording-started

    // Example event object
    {
      "action": "recording-started",
      "instanceId": "00000000-0000-4000-8000-000000000000",
      "callFrameId": "16149871051110.5607513282111183",
      "local": true, // only present for local and cloud recordings if you started the recording
      "recordingId": "cab2be92-1551-42d8-bcdf-11fe7bd81923", // only for cloud recordings
      "startedBy": "1c6d5474-b133-4993-c943-f1ffdbb38cad", // the participant that started a cloud or raw-tracks recording
      "type": "cloud" // or raw-tracks, local, or output-byte-stream
    }
    

    An example flow might look like this:

    1. User joins a session.
    2. Listen for the recording-started event. Grab the recordingId .
    3. Recording happens during the session.
    4. Listen for the recording-stopped event. Use the recordingId from earlier to request an access link.