new ClassResource(getClass(), "bip.ogg") };
final Resource[] s2 = {
new ClassResource(getClass(), "toyphone_dialling.mp3"),
new ClassResource(getClass(), "toyphone_dialling.ogg") };
final Audio audio = new Audio();
audio.setSources(s1);
audio.setShowControls(true);
audio.setHtmlContentAllowed(true);
audio.setAltText("Can't <b>play</b> media");
audio.setAutoplay(true);
addComponent(audio);
CheckBox checkBox = new CheckBox("Show controls",
new MethodProperty<Boolean>(audio, "showControls"));
addComponent(checkBox);
checkBox = new CheckBox("HtmlContentAllowed",
new MethodProperty<Boolean>(audio, "htmlContentAllowed"));
addComponent(checkBox);
checkBox = new CheckBox("muted", new MethodProperty<Boolean>(audio,
"muted"));
addComponent(checkBox);
checkBox = new CheckBox("autoplay", new MethodProperty<Boolean>(audio,
"autoplay"));
addComponent(checkBox);
Button b = new Button("Change", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
audio.setSources(s2);
}
});
addComponent(b);
getLayout().setHeight("400px");
getLayout().setExpandRatio(b, 1.0f);