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

Sound Event Play not firing after first user interaction #2017

Open
anox1337 opened this issue Apr 24, 2020 · 0 comments
Open

Sound Event Play not firing after first user interaction #2017

anox1337 opened this issue Apr 24, 2020 · 0 comments
Labels
area: sound Sound related issue bug

Comments

@anox1337
Copy link

anox1337 commented Apr 24, 2020

Hey Playcanvas Team,

love your work!!! ❤️

Carrying this over from https://forum.playcanvas.com/t/sound-event-listener-on-play-not-working/12827

Setting a sound component Autoplay to TRUE will not trigger the onPlayEvent when the user interacts for the first time. The onResumeEvent will also not work.

Demo:
https://playcanvas.com/project/680856

var soundOrigin =  this.app.root.findByName('SoundOrigin').sound;
console.log("hasevent"+soundOrigin.hasEvent("play")); //<-- false
    
soundOrigin.on("play", function (a, b) {
    console.log("Sound started");
});

The Soundboggs-Entity has the sound emitter.
The Avatar has a visualizer script which trys to register the play event.
Once you click into the scene the sound starts but the Event never fires.

If you set the Soundboggs-Sound to autoplay=false and activate the onMousedown function in the visualizer script you get the working solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: sound Sound related issue bug
Projects
None yet
Development

No branches or pull requests

3 participants