Skip to content
Snippets Groups Projects
Commit 7ea295df authored by Karishma Chadha's avatar Karishma Chadha
Browse files

Recorded sounds should have actual md5s.

parent c4b44ccd
No related branches found
No related tags found
No related merge requests found
......@@ -73,22 +73,24 @@ class RecordModal extends React.Component {
sampleRate: this.state.sampleRate,
channelData: [clippedSamples]
}).then(wavBuffer => {
const md5 = String(Math.floor(100000 * Math.random()));
const vmSound = {
format: '',
md5: `${md5}.wav`,
dataFormat: 'wav',
name: `recording ${this.props.vm.editingTarget.sprite.sounds.length}`
};
// Load the encoded .wav into the storage cache
// Load the encoded .wav into the storage cache and get resulting
// md5 from storage
const storage = this.props.vm.runtime.storage;
storage.builtinHelper.cache(
const md5 = storage.builtinHelper.cache(
storage.AssetType.Sound,
storage.DataFormat.WAV,
new Uint8Array(wavBuffer),
md5
);
// update vmSound object with md5 property
vmSound.md5 = `${md5}.${vmSound.dataFormat}`;
this.props.vm.addSound(vmSound).then(() => {
this.props.onClose();
this.props.onNewSound();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment