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
Allowing src with no extension #140
Comments
Not currently, but we've heard this is something required for Amazon hosted files and would like to add it to SoundJS. Likely we would do it by setting a property that defined the filetype. There could be some issue with browsers not supporting a given type and switching to a fallback, and then the link not returning the file with the expected extension. It will be some time before I have time to work on this, but if you would like to attempt to add in this behavior with a pull request I'd be happy to offer any support you would need. You'd likely want to start with the internal Sound._parsePath method and work from there. Hope that helps. |
Thanks, I'll let you know if I end up doing something. For now, I'm working around this by still adding the .mp3 extension to the request and modifying the server to accept the requests. |
cool You likely already know this, but if you use alternateExtensions the file may be requested with a different type. |
Hey, so I did use a workaround, I'm gonna post it here. It's not really pretty, but it works.
Then, you can call |
Nice work, thanks for sharing this. It's an interesting choice to go with a global solution, rather than an additional type property on register objects. Definitely this is quicker, but it seems on the surface like a type property could offer more flexibility. For example you could mix extensionless and extentioned files. But maybe no one does that? I'm curious about your opinion on a file specific rather than global approach? |
Also, this doesn't solve the issue where different file-types need to be served depending on the browser. |
Well if you need to serve different file-types depending on the browser, you are probably better of using an extension. You could have a URL like My personal use case involved hiding the extension from the user, making the links more confusing and also using random strings for audio files, so they cannot be programatically identified and downloaded. I'm actually serving the files from a CDN. I'm doing this although there may be issues in certain browsers with playing the audio files, but I've tested the target browsers and they all played my audio files very well (which are mp3's by the way). If I were to take the
This would pass to And the name should probably be changed from |
Thanks for sharing your thoughts. One got'cha to warn you about, Firefox plays mp3 audio using available codex on the system. So if there is no mp3 codex, playback will fail. |
We are working on some improvements to SoundJS to allow more dynamic file paths to be supported. Thanks for all your suggestions and info! |
Leaving open for tracking. |
SoundJS has added support for alternate file paths and extensionless files. Example var sounds = {path:"./audioPath/",
manifest: [
{id: "cool", src: {mp3:"mp3/awesome.mp3", ogg:"noExtensionOggFile"}}
]}; Note an id is required for playback and this is not supported with PreloadJS yet. Hope that helps. |
Hey, I have a small question. Is there anyway I can modify the library so it allows me to set the SRC without an extension, like .mp3 ?
I would like to have something like http:/www.test.com/audio/1233445 . This link will be parsed by a PHP script, which will return a Content-Type: audio/mpeg.
Anyway I can do this? Thank you so much.
PS: I get this: Uncaught TypeError: Cannot read property 'apply' of undefined
Just after I do this: window.createjs.Sound.registerSound(audio.src, audio.id, audio.data);
The text was updated successfully, but these errors were encountered: