如何嵌入Youtube视频?

问题描述 投票:-1回答:2

我想在Vaadin 8应用程序中嵌入Youtube视频。我找到的唯一一个插件是MediaElementsJSPlayer,它不支持版本8.有没有办法完成这个?

vaadin vaadin8
2个回答
2
投票

你有没有尝试过EmdeddedVideo课程来显示视频?这两个都应该有效。

对于Embedded,这里有一个例子:Vaadin framework play VideoVideo这里的官方采样器:Video

关于同一主题的其他StackOverflow问题:


1
投票

你可以使用LabelContendMode设置为ContentMode.HTML来显示几乎每个HTML内容。

例:

 @Override
    protected void init(VaadinRequest vaadinRequest) {
        final VerticalLayout layout = new VerticalLayout();

        Label video = new Label();
        video.setValue("<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/dQw4w9WgXcQ\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"); // Replace this with your actual html
        video.setContentMode(ContentMode.HTML);

        layout.addComponents(video);

        setContent(layout);
    }

您可以点击共享并选择嵌入来获取html以嵌入您的视频。

© www.soinside.com 2019 - 2024. All rights reserved.