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

Safari Issue: Can't find variable: AudioContext #7

Closed
imCorfitz opened this issue Jul 1, 2020 · 11 comments
Closed

Safari Issue: Can't find variable: AudioContext #7

imCorfitz opened this issue Jul 1, 2020 · 11 comments

Comments

@imCorfitz
Copy link

Apparently safari needs webkit prefix.
amaneureka/T-Rex#5 (comment)

@imCorfitz
Copy link
Author

Ps.. So nicely done this package.. Love it!

@foobar404
Copy link
Owner

Are you using the node, or the web version?

@imCorfitz
Copy link
Author

CDN. If I copy down the bundle and add var AudioContext = window.AudioContext || window.webkitAudioContext; at the very top, the error goes away... Unfortunately, this causes some audio issues, as to now, the sound is eliminated.. And - it is JUST Safari...

@imCorfitz
Copy link
Author

I just made a quick CodeSandBox: https://codesandbox.io/s/playing-with-the-wavejs-package-zfgio using the NPM package. If you open it up in Chrome - No issues, In ssafari, you'll see the error again regarding AudioContext.

@foobar404
Copy link
Owner

foobar404 commented Jul 2, 2020 via email

@imCorfitz
Copy link
Author

Fixing one seemed to have created a new :P I have tested the bundle with the fix here https://codesandbox.io/s/snowy-snow-p569j?file=/bundle.js , and the error does indeed go away in Safari - though now weird stuff happens where the audio doesn't even play.

@foobar404
Copy link
Owner

Okay Ill be working on a solution in the next few days.

@imCorfitz
Copy link
Author

Have a look at #8 :D You may have to package the repo yourself for release. Not sure how to...

@foobar404
Copy link
Owner

Okay I setup a development workflow and uploaded my source files. Look at the bottom of the readme to see details on how to work with the source files. I also worked for a while on the ios issue. Im not sure if I solved the issue because I dont have anyway of testing but I did implement something that should of fixed it. The audioContext is muted by safari, and is only unmuted when a user gesture happens. But you must also create the audioContext when the user event happens, and try to play a sound so safari unmutes. Hopefully the issue is now solved.

@imCorfitz
Copy link
Author

Great stuff this.. I have had a little browse-through... I looked into the react-test - which is failing due to the wave.fromElement only accepting strings for IDs and finding the elements automatically, whereas the thought of being able to assign an actual element as parameter, may be a good idea - especially on the react side of things.. We should look further into that..

The Safari issue has been resolved, but testing on the iPhone doesn't seem to work well.. Not sure if this is a localhost issue or bug in code, so will get back to you on that.. Great job solving the Safari bug.. cheers..

@imCorfitz
Copy link
Author

Oh.. Guess we can actually close this issue now then
/close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants