I am working on a react project. I have a video file in public folder. There is a case where i have to read the file and send it to server as a file.i tried the below code and it didn't work
const readVideo = () => {
console.log(isDev.current.checked);
fetch("/images/Sample_2.mp4").then(function (response) {
console.log(response);
const reader = new FileReader();
reader.onload = (e) => {
console.log(e.target.result);
};
reader.readAsDataURL(response.url);
});
};
when doing this im getting the following error
Unhandled Rejection (TypeError): Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'.