Playing simple sounds


I need that my customer’s Vaadin app plays simple sounds on demand (they are audible alarms). So far, I’ve found an old post from 2009 that describes an add on that integrates an extension of GWT, but is based on Flash. Generally speaking I don’t have anything against plugin, indeed I take care of a lot of applet development, but for this specific project I picked Vaadin because the customer wants to rely on HTML + JavaScript only. Is there any update on that add on? In the meantime HTML is supposed to have be enhanced and in any case we don’t need a broad browser compatibility (Firefox and Internet Explorer would be fine).


You can use “out-of-box” com.vaadin.ui.Audio component in Vaadin 6.7.
It works :wink:
Of course browser must support HTML5 audio.

Thanks. It works fine. I still have to figure it out how to hide the player from the rendering, keeping it working, but this is a HTML5 question.

Umm … Pretty old post, but did you figure out how to hide the player element?
I tried following CSS:

.v-audio { display: none; } which basically does what it should - it hides the HTML5

And this causes a displacement for my component…

Did a strange workaround, but works for me:

final Audio FAILSOUND = new Audio(null, new ThemeResource("resources/audio/failure.mp3"));
FAILSOUND.setShowControls(false); FAILSOUND.setSizeUndefined();


content.setExpandRatio(FAILSOUND, 0);
content.setExpandRatio(componentIdLikeToSee, 1);;