-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
update p5 sound examples to start audio on a user gesture #396
Comments
Hi, this is the github for the p5.js website. You might want the p5.js github which is here: https://github.com/processing/p5.js/ For your issue, the easiest way to resolve it is to have the equivalent of a play button, i.e. something that is clicked on the canvas before any sound plays. You could also try the userStartAudio() function from this example: https://p5js.org/reference/#/p5.sound/userStartAudio |
Change was made to the inline examples here processing/p5.js-sound#403 processing/p5.js#3988 and now the examples that live in the website repo also should be updated. The examples should be re-designed to follow the best practice of starting audio (i.e. with |
@singhvisha do you have any interest in helping out with rewriting some of the samples to follow @therewasaguy 's proposal above? |
I'm interested in helping rewriting them @stalgiag but I'm clueless on what direction to take, any help @therewasaguy? I'm getting the following errors on AudioIn Example: Chrome Version 79.0.3945.130
Firefox 73.0.1{
name: "NotFoundError",
message: "The object can not be found here.",
constraint: "",
stack: ""
} |
@stalgiag, Sorry for late answering.I was out of town. I would love to do. |
Let me know if you need a hand @singhvisha |
I have a working example here: https://github.com/vilvadot/p5-mic-example/blob/master/src/sketch.js Haven't been able to make it work on Firefox though. |
@therewasaguy |
@endurance21 yes, we can follow the rewrite that went into the inline examples. processing/p5.js-sound#403 should provide some guidance on how to redesign the examples—thank you for finding and linking that! I apologize I did not already link this in the thread! |
Sound is currently not working in Chrome due to changes in the way that sound can be played. It seems that Chrome now only allows a sound context to be created with a user click.
Console log error message:
The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
(anonymous) @ p5.sound.js:211
(anonymous) @ p5.sound.js:292
(anonymous) @ p5.sound.js:73
(anonymous) @ p5.sound.js:74
The error occurs three times, no sound plays.
The text was updated successfully, but these errors were encountered: