Example code for "com.vaadin.ui.Video"?

I cannot find any example code for the new class
com.vaadin.ui.Video
added to Vaadin 6.7 for using the new HTML5 "
video
" element to embed video. No entries in the Sampler or Book of Vaadin, nor google hits.

Can someone point me to any example uses?

It does not look terribly complicated. But I’m new to Vaadin Resource class. And I’m wondering about how to control proper size of the video display area.

–Basil Bourque

Some more googling led me to stumble over some example code used in Vaadin’s own test code. I adapted that test code to this little example app.

Quick and easy: Make a new app, plus one other class. Paste code below and run.

Application subclass:

package com.example.dummy;

import com.vaadin.Application;
import com.vaadin.ui.*;

public class DummyApplication extends Application {

    @Override
    public void init() {
        Window window = new com.example.dummy.VideoWindow();
        this.setMainWindow( window );
    }

}

VideoWindow:

/**
 * 
 */
package com.example.dummy;

import com.vaadin.terminal.ExternalResource;
import com.vaadin.ui.Audio;
import com.vaadin.ui.Button;
import com.vaadin.ui.Video;
import com.vaadin.ui.Window;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;

/**
 * This source code adapted from Vaadin's test code, found via googling:
 * http://dev.vaadin.com/browser/svn/versions/6.7/tests/testbench/com/vaadin/tests/components/media/Media.java?rev=21440
 * 
 * @author Basil Bourque. (Originally code from Vaadin.com)
 * 
 */
public class VideoWindow extends Window {

    /**
     * 
     */
    public VideoWindow() {
        super();
        this.setCaption( "Demo HTML5 Video Tag" );

        final Video v = new Video( "video" );
        v.setSources( new ExternalResource( "http://jonatan.virtuallypreinstalled.com/media/big_buck_bunny.mp4" ),
                new ExternalResource( "http://jonatan.virtuallypreinstalled.com/media/big_buck_bunny.ogv" ) );
        v.setWidth( "640px" );
        v.setHeight( "360px" );
        addComponent( v );
        addComponent( new Button( "Play video", new ClickListener() {

            public void buttonClick( ClickEvent event ) {
                v.play();
            }

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

            public void buttonClick( ClickEvent event ) {
                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() {

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

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

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

        } ) );
    }

}

I’d still like to here of any other examples.

–Basil Bourque