react-sound icon indicating copy to clipboard operation
react-sound copied to clipboard

Sound from local directory.

Open AnHal opened this issue 8 years ago • 8 comments

Hi, i am creating an App with React/Meteor. I installed react-sound and it works fine, when I take an Url from the Internet, for example those from the example. But actually, I wanted to play music, stored in a local directory. I tryed many diffrent absoulute and relative paths, but I always get this error:

   sound0: Failed to load / invalid sound? Zero-length duration reported. 

Is it event possible to play music from local directory or do i have to consider any special things? Thanks

AnHal avatar Jun 19 '17 12:06 AnHal

I believe you need to have the files in the /public/ directory to reference them like this

C-Higgins avatar Jul 18 '17 18:07 C-Higgins

You need to be able to serve those sounds with a server, then use that url in the Sound component.

leoasis avatar Jul 18 '17 21:07 leoasis

we have no chance to use it from a local file?

aozfen avatar Dec 19 '17 11:12 aozfen

You can. If open html from local file.

peinguin avatar Dec 19 '17 11:12 peinguin

Could you give an example on this? How will I do

aozfen avatar Dec 19 '17 11:12 aozfen

https://stackoverflow.com/questions/371875/local-file-access-with-javascript - but user should select file by hands https://developer.mozilla.org/en-US/docs/Archive/Misc_top_level/Same-origin_policy_for_file:_URIs

peinguin avatar Dec 19 '17 11:12 peinguin

https://en.wikipedia.org/wiki/Same-origin_policy

peinguin avatar Dec 19 '17 11:12 peinguin

I am storing my audio files in an Audio collection in mongoDB. How can I access those audio files and play them? Or is there a way to reference them as url?

AndreiEgorov avatar Aug 06 '18 04:08 AndreiEgorov