我想在Vaadin 8应用程序中嵌入Youtube视频。我找到的唯一一个插件是MediaElementsJSPlayer,它不支持版本8.有没有办法完成这个?
你有没有尝试过Emdedded
或Video
课程来显示视频?这两个都应该有效。
对于Embedded
,这里有一个例子:Vaadin framework play Video和Video
这里的官方采样器:Video
关于同一主题的其他StackOverflow问题:
你可以使用Label
和ContendMode
设置为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以嵌入您的视频。