|
|
@ -911,19 +911,23 @@ async function sendVideoData(newState, overrideChanges) {
|
|
|
|
loadPromiseResolve = resolve;
|
|
|
|
loadPromiseResolve = resolve;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
fileReader.addEventListener("loadend", (event) => {
|
|
|
|
fileReader.addEventListener("loadend", (event) => {
|
|
|
|
loadPromiseResolve(event.target);
|
|
|
|
loadPromiseResolve();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
fileReader.readAsArrayBuffer(fileHandle);
|
|
|
|
fileReader.readAsDataURL(fileHandle);
|
|
|
|
const fileLoadData = await loadPromise;
|
|
|
|
await loadPromise;
|
|
|
|
|
|
|
|
const fileLoadData = fileReader.result;
|
|
|
|
if (fileLoadData.error) {
|
|
|
|
if (fileLoadData.error) {
|
|
|
|
submissionResponseElem.innerText = `An error (${fileLoadData.error.name}) occurred loading the custom thumbnail: ${fileLoadData.error.message}`;
|
|
|
|
submissionResponseElem.innerText = `An error (${fileLoadData.error.name}) occurred loading the custom thumbnail: ${fileLoadData.error.message}`;
|
|
|
|
submissionResponseElem.classList.value = ["submission-response-error"];
|
|
|
|
submissionResponseElem.classList.value = ["submission-response-error"];
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const fileData = fileLoadData.result;
|
|
|
|
if (fileLoadData.substring(0, 22) !== "data:image/png;base64,") {
|
|
|
|
const fileBytes = new Uint8Array(fileData);
|
|
|
|
submissionResponseElem.innerHTML =
|
|
|
|
const fileBinaryString = String.fromCharCode(...fileBytes);
|
|
|
|
"An error occurred converting the uploaded image to base64.";
|
|
|
|
thumbnailImage = btoa(fileBinaryString);
|
|
|
|
submissionResponseElem.classList.value = ["submission-response-error"];
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
thumbnailImage = fileLoadData.substring(22);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|