0

I'm trying to add a YouTube video to a page:

    IFrame iFrame = new IFrame("https://www.youtube.com/watch?v=sLTvQnjEkRU");
    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);

but FireFox unable to display it. How to properly add YouTube video to the page in Vaadin23 ?

alexanoid
  • 24,051
  • 54
  • 210
  • 410
  • Your code works for me on FireFox 104 (and Chrome) like a charm. I can see and hear the video alright. – Tarek Oraby Aug 26 '22 at 12:52
  • 1
    Are there errors/warnings in the dev-console of the browser? Or non-200-status-codes in the network-tab? – cfrick Aug 26 '22 at 13:02
  • Thanks for your answers! With the link in the question - FF blocks the player. I found the reason - In order to show it correctly we have to use embedded YouTube links, like `https://www.youtube.com/embed/sLTvQnjEkRU` – alexanoid Aug 26 '22 at 21:27

0 Answers0