-1

I'm working on a website and trying to add a popup video attached to an tag.

I've seen two or three possible solutions to my problem, but they didn't work the way I'd like them to. Some of the guides were made 10 years ago and are outdated too.

The last thing I tried was the "Magnific popup" method, I could insert the popup, but the video didn't load:

Image of what is happening

HTML

 <a class="popup-youtube" href="https://www.youtube.com/watch?v=QwGf3ZH1ZUQ">Open YouTube video</a><br>

Javascript

$(document).ready(function() {
    $('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
        disableOn: 700,
        type: 'iframe',
        mainClass: 'mfp-fade',
        removalDelay: 160,
        preloader: false,

        fixedContentPos: false
    });
});
Moritz Ringler
  • 9,772
  • 9
  • 21
  • 34
  • Possible duplicate of https://stackoverflow.com/questions/16917624/magnific-popup-error-when-opening-a-you-tube-video – TylerH Feb 22 '23 at 20:43

1 Answers1

-1

You can try to download the video and, instead of importing the video from youtube, import it from you local storage.

<video src="video.mp4" width="420" height="240"></video>

  • Thanks for the suggestion, but unfortunatelly won't work, because I need the website depends on the user inserting youtube videos. – Adrian Sivilha Feb 17 '23 at 13:19