goldfire / howler.js

Javascript audio library for the modern web.
https://howlerjs.com
MIT License
23.74k stars 2.22k forks source link

Files without extension as part of url don't pause/resume #776

Closed JJ-Atkinson closed 4 years ago

JJ-Atkinson commented 7 years ago

I'm working on a media player app using howler.js, and I've run into an interesting problem. It appears that if I load a file with a URL that does not have the file extension specified, it won't allow me to pause and resume. For instance:

var player = new Howl({src: "/api/audio-file/156", html5: true});
player.play()
// sleep(5000)
player.pause()
player.play()

The last player.play() will start from the beginning of the track, whereas using a URL with a file extension (https://howlerjs.com/assets/howler.js/examples/player/audio/rave_digger.mp3, for example) resumes 5 seconds in. Also, it appears howl doesn't take into account the Content-Type of the response.

goldfire commented 7 years ago

Is this a situation where you don't know the filetype? If you do, you can specify it with format: https://github.com/goldfire/howler.js#format-array-.

JJ-Atkinson commented 7 years ago

Not on the client. The server knows, but I don't have a way to put that in the request url without redirecting. I did put the Content-Type header in the response with the correct file type though, and I figured that would make it work ok. Chrome plays the files fine, but howl complains that it can't find the file type.