Cannot record audio on iOS Safari browser

I’m using MediaRecorder to record audio and sending it to the backend as a blob but I’m facing issue with iOS Safari browser where I’m getting blob of length 0 at the backend. Same code was tested on older iPhone (iOS 15.5) and everything works fine there, problem seems to be with iOS version 17.4 and above. Facing same issue with chrome as well on iOS.

Below is the code that converts chucks into blob:

async readFile(chunks, type = "audio/wav", filename = "abc") {
    const name = `${filename}.${type.split("/")[1]}`;
    return new Promise((resolve, reject) => {
      const modifiedFile = new File(chunks, name, {
        type: type,
      });
      const fileReader = new FileReader();
      fileReader.readAsDataURL(modifiedFile);
      fileReader.onloadend = () => {
        resolve(fileReader.result);
      };
      fileReader.onerror = () => {
        reject(fileReader.error);
      };
    });
  }