A Demo, but a question too

I created this little piece which is kind of a show of respect for an actor from the 1940s - Sydney Greenstreet.

The Detective’s Office

View it with Firefox - the intro audio plays - then click on the monitor - and a conversation plays (the cell phone changes until the end of the conversation. )

Now in Chrome the scene loads but nothing happens - no audio …

Now I looked at this thread but I can’t figure out all the “audioEngine.useCustomUnlockedButton = true”, “audioEngine.unlock()” and “button.onclick = () => { BABYLON.Engine.audioEngine.unlock();” suggested by @sebavan. I tried putting this stuff all over the place with no effect.

I’m no coder, so could someone show me some working code that I can use to run this in Chrome?

It really does seem a shame that Google makes things so awkward…

And some questions is “pickable” the same as “clickable” and how is the" button" defined?

Hope someone can help … otherwise I will have no hair left!

cheers, gryff :slight_smile:

2 Likes

It basically mean you need a user interaction to unlock audio so a button click is by far the easiest.

Just put a start buttton somewhere and button.onclick = () => { BABYLON.Engine.audioEngine.unlock(); }

This will ensure to unlock the audio stack only on your custom button click.

If it does not work, please create a tiny playground repro and I ll look into it.

2 Likes

I’ll give it a shot @sebevan - and TY. I just hate to add a “start” button cluttering up the scene.

cheers, gryff :slight_smile:

Yup unfortunately too many abuse of ads…

Looking pretty awesome @gryff! You’ve got that Film Noir vibe down!!!

1 Like

@PirateJC : Thanks - exactly what I am trying to do. And I always enjoyed Sydney Greenstreet. Wonderful voice (along with Peter Lorre who played Joel Cairo in the “Maltese Falcon”).

cheers, gryff :slight_smile:

1 Like

I don’t think you actually need a button, any click on the page should suffice. I use a one time disposable handler for this on another project.

yup any user interaction would do. The button is usually easier to discover for the users. The splash screen can do well here as well.

Well, getting nowhere fast. There is even a demo PG that does not work without having to click on the BJS Window here. How would you alter that code so that symbol (top left) does not appear?

I can get things to start on my files by right clicking on the tab and then selecting “unmute”. It really is driving me nuts :frowning:

Opening the console window in Chrome gives me this message :frowning:

babylon.js:16 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page

What code and where do you put that code to over ride that?

cheers, gryff :slight_smile:

This should work:

https://playground.babylonjs.com/#DXAEUY#29

1 Like

TY @sebavan !! It looks good will start giving it a try.

Hopefully that finally solves this issue for me.

cheers, gryff :slight_smile:

I don’t know if you already updated but it was playing sound for me on chrome on page load. Didn’t have to trigger any user interaction.

This is super cool!

@sebavan, sometimes after reloading and hard reloading the demo, the button doesn’t appear and the sound plays without me interacting with the page. Is that normal/expected?

yes if you just reload, but on a new tab it should ask again :slight_smile: