I'm working on a library that can extract audio from HTML5 <audio>
and <video>
elements and send it to a remote server for speech-to-text processing. (e.g. automatic subtitles.) When I test manually, everything works as expected, but when karma runs my test, it always fails for <audio>
elements.
For context, HTML5 audio script processors immediately get a stream of audio as soon as they are connected to an <audio>
element, but it's all 0's (no sound) until the element begins playing.
When my tests run in karma, it appears that the element never begins playing; I just get 0's even though I've called .play()
on the element. Also, I don't hear any audio coming out of my speakers, which should happen at the same time.
(I get that audio during tests could be super-annoying and probably should be disabled by default, but is there a way to enable it for cases like mine?)
If you're interested in seeing the code, it's at https://github.com/watson-developer-cloud/speech-javascript-sdk but it's still a bit of a mess, and is currently configured to skip the tests that would fail. If necessary, I'll try and set up a stripped down example, but I'm hoping I won't need to.
I'm on OS X if it makes a difference. I haven't tried this on Windows or Linux yet.