convert to blob
This commit is contained in:
parent
1fca6f25b8
commit
1fd9ba5dbf
1 changed files with 5 additions and 5 deletions
|
|
@ -64,7 +64,7 @@ export function registerSamplesFromDB(config = userSamplesDBConfig, onComplete =
|
||||||
//fallback to file name before period and seperator if no parent directory
|
//fallback to file name before period and seperator if no parent directory
|
||||||
splitRelativePath[splitRelativePath.length - 2] ?? soundFile.id.split(/\W+/)[0] ?? 'user';
|
splitRelativePath[splitRelativePath.length - 2] ?? soundFile.id.split(/\W+/)[0] ?? 'user';
|
||||||
|
|
||||||
const soundPath = bufferToDataUrl(soundFile.buf);
|
const soundPath = blobToDataUrl(soundFile.blob);
|
||||||
|
|
||||||
// const soundPath = soundFile.blob;
|
// const soundPath = soundFile.blob;
|
||||||
const soundPaths = sounds.get(parentDirectory) ?? new Set();
|
const soundPaths = sounds.get(parentDirectory) ?? new Set();
|
||||||
|
|
@ -164,16 +164,16 @@ async function processFilesForIDB(files) {
|
||||||
const sUrl = URL.createObjectURL(s);
|
const sUrl = URL.createObjectURL(s);
|
||||||
//fetch the sound and turn it into a buffer array
|
//fetch the sound and turn it into a buffer array
|
||||||
return fetch(sUrl).then((res) => {
|
return fetch(sUrl).then((res) => {
|
||||||
return res.arrayBuffer().then((buf) => {
|
return res.blob().then((blob) => {
|
||||||
const path = s.webkitRelativePath;
|
const path = s.webkitRelativePath;
|
||||||
let id = path?.length ? path : title;
|
let id = path?.length ? path : title;
|
||||||
if (id == null || title == null || buf == null) {
|
if (id == null || title == null || blob == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
title,
|
title,
|
||||||
buf,
|
// buf,
|
||||||
// blob: base64,
|
blob,
|
||||||
id,
|
id,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue