Audio not working


#1

Hi there,

I’m looking to trigger a sound when a plane is pressed down.
There doesn’t seem to be any step-by-steps on this so i’m missing something crucial…

I have a 1 second audio clip, tried both wav and ogg.

The clips aren’t playing sound when the play icon is pressed in the properties menu.
Nor does any sound happen when you create a timeline.

My presseddown script looks like this:

const lilypad_png1 = parent;

  • What do will I need to write in the myaudio.start();

Thank you for your help!


#2

You may need to put in the entire path to play it. It might be because the audio object has not been added to the scene after you generate it.

I’m not really sure since I have always added clips as nodes in the project editor and referenced them directly.
I find this to be easier, unless something needs created at runtime.
This also prevents generating a new audio object every time you press the plane.


#3

Hi there,

There seems to be an issue with the play button in the audio node’s properties panel not playing audio.

Thanks for bringing this to our attention.

However, if you scan the experience the functionality should work, although you may want to move your declaration of the myaudio variable outside of the pointerdown event handler (under your other variable declaration).

If the audio functionality doesn’t work even when scanning then please let me know.

Thanks,
Seb


#4

Thanks for replying!

It worked fine once I previewed and scanned the content on my phone, just not within ZapWorks studio. I’ll bare this in mind in future!