Created
December 15, 2022 18:15
-
-
Save curtis1000/cdf75e9b712b2caa4db98b9a63eb853b to your computer and use it in GitHub Desktop.
upload-recording.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function uploadRecording() { | |
// get a presigned url | |
let response = await fetch('https://<url to the lambda>?'+ new URLSearchParams({ | |
type: videoFormat() | |
})); | |
const { uploadURL } = await (response).json(); | |
response = await fetch(uploadURL, { | |
method: 'PUT', | |
mode: 'cors', | |
cache: 'no-cache', | |
credentials: 'omit', | |
headers: { | |
'Content-Type': `video/${videoFormat()}` | |
}, | |
redirect: 'follow', | |
referrerPolicy: 'no-referrer', | |
body: recordingBlob | |
}); | |
if (!response.ok) { | |
console.error('Unable to upload video', response); | |
} | |
const win: Window = window; | |
win.location = "/submission-received.html"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment