Sounds don't work

The following does not throw and error but also does not play a sound.

Audio sound = new Audio(null, new ThemeResource(“sounds/cashregister.mp3”));
sound.play();

This code is from the
Sampler
:

Audio sample = new Audio();
final Resource audioResource = new ExternalResource(
"http://mirrors.creativecommons.org/ccmixter/contrib/Wired/The%20Rapture%20-%20Sister%20Saviour%20(Blackstrobe%20Remix).mp3");
sample.setSource(audioResource);
sample.setHtmlContentAllowed(true);
sample.setAltText("Can't play media");

can you check if it works?

-Olli

Tried the following

this.filledTradeSound = new Audio();
final Resource audioResource = new ExternalResource(“https://www.soundjay.com/mechanical/sounds/gun-cocking-01.mp3”);
filledTradeSound.setSource(audioResource);
filledTradeSound.setHtmlContentAllowed(true);
filledTradeSound.setAltText(“Can’t play media”);Does not work, no sound.

Hi,

I tested your code out and it seems to work for me. Tested in Chrome, IE11, Edge and Firefox. Are you adding the Audio component to a Layout?

-Olli

O perfect. thats works.

Great!

-Olli