Watch Vaadin Video

Can I play videos with Vaadin framewotk? The main idea is to download video files from a local disk in flv or avi formats and play them online using the vaadin framework. Thank.

+5
source share
5 answers

There is a sample in the sampler: http://demo.vaadin.com/sampler/#FlashEmbed You can see the source by clicking "View Source" and it will show you something like this:

Embedded e = new Embedded(null, new ExternalResource(
                "http://www.youtube.com/v/meXvxkn1Y_8&hl=en_US&fs=1&"));
e.setMimeType("application/x-shockwave-flash");
e.setParameter("allowFullScreen", "true");
e.setWidth("320px");
e.setHeight("265px");
addComponent(e);

Obviously, you need to change the ExternalResource to something else (e.g. FileResource, ClassResource, StreamResource, ...) in order to play local files.

+7
source

Vaadin 6.7 Video, "HTML5" .

My Vaadin .

:

Video v = new Video( "video" ); // Instantiate video player widget.
// Specify a list of your video in one or more formats.
// Different browsers support various different video formats.
v.setSources( 
    new ExternalResource( "http://www.example.com/media/example_video.mp4" ),
    new ExternalResource( "http://www.example.com/media/example_video.ogv" ) 
); 
v.setWidth( "640px" ); // Set size of the video player display area on-screen.
v.setHeight( "360px" );
this.addComponent( v ); // Add the component to the window or layout.

, - . Vaadin? "ExternalResource", , Vaadin Resource .

+3
+1

. :

        FileResource fileResource = new FileResource(new File("/Users/user/Downloads/DBTI_1991_teaser_HD.mp4"));
        Video vd = new Video();
        vd.setAutoplay(true);
        vd.setSource(fileResource);
        this.addComponent(vd);
+1

Another alternative is the Vaadin YouTubePlayer add- on if you want to access YouTube.com videos.

0
source

All Articles