howler.js icon indicating copy to clipboard operation
howler.js copied to clipboard

Cannot play webm from data url with "video/webm" mime type (from webpack)

Open nebaughman opened this issue 4 years ago • 1 comments

Using howler 2.2.3 (loving it so far, thanks!)

In a vue-cli project, webpack is configured to embed a data url when a resource is small enough. It interprets a webm file as video and uses data:video/webm;base64,... which howler refuses to load (entirely silently; none of the error callbacks are called).

Workaround:

    let src = require("@/path/to/sound.webm")
    if (src.startsWith("data:video/webm")) { 
      src = src.replace("data:video/webm", "data:audio/webm")
    }

The workaround works fine; howler loads and can play the sound.

In case it matters, I created the webm via ffmpeg -i sound.wav sound.webm (nothing fancy).

I'm not sure if it would be appropriate to have howler treat mime type "video/webm" as an acceptable source of audio. Minimally, please signal an error callback. Thanks for your consideration!

nebaughman avatar Jul 31 '21 20:07 nebaughman

they @nebaughman thank you very much for sharing this.

dheimoz avatar Aug 01 '21 19:08 dheimoz