Skip to content

Instantly share code, notes, and snippets.

@curtis1000
Created December 15, 2022 18:15
Show Gist options
  • Save curtis1000/cdf75e9b712b2caa4db98b9a63eb853b to your computer and use it in GitHub Desktop.
Save curtis1000/cdf75e9b712b2caa4db98b9a63eb853b to your computer and use it in GitHub Desktop.
upload-recording.ts
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