Skip to content

Question: record audio and upload to S3 #3002

Answered by katspaugh
visualight asked this question in Q&A
Discussion options

You must be logged in to vote

You should first download the recorded URL and only then upload it to S3. E.g.:

record.on('stopRecording', () => {
  const blobUrl = record.getRecordedUrl()

  fetch(blobUrl)
    .then(response => response.blob())
    .then(blob => {
        // Create params for S3 upload
        const uploadParams = {
            Bucket: 'YOUR_BUCKET_NAME',
            Key: 'your_file_name_here', // replace with your desired file name
            Body: blob,
            ACL: 'public-read' // if you want the file to be readable publicly
        };

        // Call S3 to retrieve upload file to specified bucket
        s3.upload(uploadParams, (err, data) => { ... })
      })
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@visualight
Comment options

Answer selected by visualight
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #3001 on July 11, 2023 07:58.