Package com.vaadin.ui

Examples of com.vaadin.ui.Audio


                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);
View Full Code Here


                v.pause();
            }

        }));

        final Audio a = new Audio("audio");
        a.setSources(
                new ExternalResource(
                        "http://jonatan.virtuallypreinstalled.com/media/audio.mp3"),
                new ExternalResource(
                        "http://jonatan.virtuallypreinstalled.com/media/audio.ogg"));
        addComponent(a);

        addComponent(new Button("Play audio", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                a.play();
            }

        }));
        addComponent(new Button("Pause audio", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                a.pause();
            }

        }));
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Audio

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.