How can I play Youtube videos in Vaadin?

Hi!

Do you know how to play youtube videos in Vaadin?

I have tried

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);

I also have tried

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);

But that won’t work for be because I’m using Vaadin 14.

This seems to work:

        IFrame iFrame = new IFrame("https://www.youtube.com/embed/dQw4w9WgXcQ");
        iFrame.setHeight("315px");
        iFrame.setWidth("560px");
        iFrame.setAllow("accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture");
        iFrame.getElement().setAttribute("allowfullscreen", true);
        iFrame.getElement().setAttribute("frameborder", "0");
		add(iFrame);

Olli Tietäväinen:
This seems to work:

        IFrame iFrame = new IFrame("https://www.youtube.com/embed/dQw4w9WgXcQ");
        iFrame.setHeight("315px");
        iFrame.setWidth("560px");
        iFrame.setAllow("accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture");
        iFrame.getElement().setAttribute("allowfullscreen", true);
        iFrame.getElement().setAttribute("frameborder", "0");
		add(iFrame);

Tackar!
I will test this tomorrow and then give a reply!

Thanks! It works!