Skip to content
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

Uncaught (in promise) DOMException: Failed to load because no supported source was found #60

Closed
stefanoslig opened this issue Sep 18, 2017 · 12 comments
Labels

Comments

@stefanoslig
Copy link

stefanoslig commented Sep 18, 2017

Hello, I tried to use this library into an angular 2 project but I get the following error:
Uncaught (in promise) DOMException: Failed to load because no supported source was found

At the app.component,ts of my app I added the following commands:

this.rythm = new Rythm();
this.rythm.setMusic('../assets/rythm.mp3');
this.rythm.start() 

Unfortunately, I'm not able to give you more information because I don't know which is the problem and I didn't find something to help me.

Has anyone the same problem or does anybody has any idea about this error?
Thank you!

@Okazari
Copy link
Owner

Okazari commented Sep 18, 2017

Gonna try an angular integration tomorrow to see if i can reproduce.

@stefanoslig
Copy link
Author

ok, thanks

@Okazari
Copy link
Owner

Okazari commented Sep 18, 2017

I have doubts about your mp3 URL. it may be "/assets/rythm.mp3" or import mySong from '../assets/rythm.mp3' depending on the way you load statics into your app but i don't think relative could work here out of the box.

@stefanoslig
Copy link
Author

I have tried to use an absolute path but didn't work

@Okazari
Copy link
Owner

Okazari commented Sep 18, 2017

Could you try with this one ? (just tell me if there is CORS) https://okazari.github.io/Rythm.js/samples/rythmC.mp3

@stefanoslig
Copy link
Author

It's working on Edge with this url. I get the following error on Chrome:

MediaElementAudioSource outputs zeroes due to CORS access restrictions for https://okazari.github.io/Rythm.js/samples/rythmC.mp3

@Okazari
Copy link
Owner

Okazari commented Sep 18, 2017 via email

@stefanoslig
Copy link
Author

ok, thanks a lot for your time!

@nesvand
Copy link
Contributor

nesvand commented Sep 21, 2017

Depending on your build chain @stefanos- I'd suggest using something like https://github.com/webpack-contrib/url-loader to generate the correct URL string to pass in to the library at run time

@Okazari
Copy link
Owner

Okazari commented Sep 21, 2017

I did try on my angular poc... I did eject the conf to add "mp3" in the url-loader regex into the webpack config but i'm still running into a build issue module "./rythmC.mp3" not found...
God i hate angular 😂

@Okazari
Copy link
Owner

Okazari commented Sep 21, 2017

So, the easiest solution that worked for me here is :
1 - Add your file into the "assets" folder
2 - You should be able to acces it at /assets/rythm.mp3 in your browser
3 - The call to rythm.setMusic("/assets/rythm.mp3") should now work.

@Okazari
Copy link
Owner

Okazari commented Oct 24, 2017

Closing, no activity in more than 1 month.

@Okazari Okazari closed this as completed Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants