Created
May 12, 2020 14:58
-
-
Save dongido001/1e9d34296ec3b72ffc8e2f35214f6c45 to your computer and use it in GitHub Desktop.
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
// [...] | |
recording.addEventListener("pointerup", async () => { | |
// Stop the recording | |
recorder.state == "recording" && recorder.stop() | |
recordedChunks = await recordedChunks | |
recordedBlob = new Blob(recordedChunks, {type: 'audio/ogg; codecs="opus"'}); | |
// Create an audio file | |
var audioFile = new File([recordedBlob], "audio.ogg", { | |
type: 'audio/ogg; codecs="opus"', | |
}); | |
// Send the recorded file to Stream CDN | |
response = await channel.sendFile( | |
audioFile, | |
'audio.ogg', | |
) | |
const attachments = [{ | |
type: 'file', | |
thumb_url: response.file, | |
asset_url: response.file, | |
}] | |
// Send the attachment to the channel | |
sendMessage("", attachments) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment