Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

446
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda