-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Karma webserver fails to properly serve mp3 files #2320
Comments
@kahwee Indeed. Missed your issue as it was already closed. Thanks for pointing me to your fix. For now until your fix is part of a release I have downgraded Karma and my tests run just fine. |
Looks like the fix for this has already been released, so this can probably be closed now. |
Close as duplicate #2310 Feel free reopen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For a few of our unit tests I tried to set up audio elements and play them. The promise that Chrome returns on HTMLAudioElement.play() returns always rejects with a 'no available source' error. As far as I can tell the Karma web server that I configured to serve my mp3 files using the files pattern and required proxy does not properly serve the file.
I then kept the karma webserver alive using the
singleRun: false
flag and tried to access the file directly from Chrome at http://localhost:9876/audio/{filename}.mp3.Expected behavior
The browser should be able to play the sound.
Actual behavior
The mp3 file is found. Webserver therefore seems to be properly configured. It is never able to play the file though.
Audio.readyState
stays at0: HAVE_NOTHING
.Comparing the request to the mp3 file with one to our regular dev environment that is opening up the server via
grunt-contrib-connect
I notice a few differences. The response headers includeconnection: close
despite a request forkeep-alive
. It is missing acontent-length
header but containstransfer-encoding: chunked
.Also the
nocache
option of the file pattern seems to be ignored as the mp3 is served withcache-control: no-cach
andpragma: no-cache
headers.Enviroment Details
karma.config.js
fileThe text was updated successfully, but these errors were encountered: