Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

445
Views
How can I create a url with extension for an audio/wav object fetched from API properly?

My task is to fetch an audio/wav file from an API call, store it in redux state and on button click play it.

  1. I have the following redux saga generator function fetching it and creating a blob right now:
export function* getAudioSaga () {
    try {
        const headers = {
            Accept: 'audio/wav',
        };
        const options = {
            headers,
            method: 'GET',
        };
        const audio = yield call(fetch, GET_AUDIO_API, options);
        const blob = yield audio.blob();
        const url = URL.createObjectURL(blob);

        yield put(getAudioSuccess(url));
    } catch (error) {
        yield put(getAudioError(error));
    }
}
  1. With getAudioSuccess action I save the created url into the redux state and I simply pass the stored url to a helper function:
export const playAudio = (url: string) => {
    const audio = new Audio(url);
    audio.play();
};

Right now I get an error if I try to use this generated blob url: Uncaught (in promise) DOMException: Failed to load because no supported source was found.

Any help would be appreciated!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!