Play video in Vaadin

可紊 提交于 2019-12-08 09:37:42

问题


I'm a beginner with Vaadin, and I have a problem when play video. The video always plays with file size of video although I set fixed dimensions. Anyone can help me? Thanks so much!

My code :

public class VideoPreview extends CssLayout{

    Video video;

    public VideoPreview(String uri) {
        video = new Video(null, new ExternalResource(uri, "video/mp4"));
        video.setAltText("Can't play video");
        video.setAutoplay(true);
        video.setWidth("320px");
        video.setHeight("265px");
        addComponent(video);
    }
} 

回答1:


Can you check this code from vaadin sampler :

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

It works for me both chrome and firefox. I think your firefox addons may cause this problem.



来源:https://stackoverflow.com/questions/25355621/play-video-in-vaadin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!