Closed ghost closed 8 years ago
Found the the solution. The page specified previously needed to be served from a server. I was opening the page from my local drive. Here are the references from stackoverflow that explains the issue.
http://stackoverflow.com/questions/21112025/how-to-embed-youtube-video-in-magnific-popup?s=1|1.6376
http://stackoverflow.com/questions/26867538/magnific-popup-youtube-video-doesnt-load
http://stackoverflow.com/questions/16917624/magnific-popup-error-when-opening-a-you-tube-video/17319478#17319478
http://stackoverflow.com/questions/26867538/magnific-popup-youtube-video-doesnt-load
$(document).ready(function() { $('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({ disableOn: 800, type: 'iframe', mainClass: 'mfp-fade', removalDelay: 160, preloader: false, iframe:{ patterns:{ youtube:{ index: 'youtube.com', id: 'v=', src: 'https://www.youtube.com/embed/%id%' }, }, srcAction:'iframe_src', }, fixedContentPos: false }); }); in this src: 'https://www.youtube.com/embed/**%id%'** in /id you can replace v=pBFQdxA-apI in your html show href="https://www.youtube.com/watch?v=pBFQdxA-apI" it will be work but it use in static not in dynamic
I have the following html to show youtube and vimeo video using magnific. The problem is that when I click on the link to popup the youtube/vimeo video, it give an error that the file is not found. With some investigation the firefox console shows that the browser is trying to locate a local file and not the youtube/vimeo url. In firefox, clicking the youtube link results in error message ... file:///embed/pBFQdxA-apI?autoplay=1&c=UTF-8&f=regular&d=Firefox can't find the file at /embed/pBFQdxA-apI?autoplay=1. In chromium, the error message ... GET file://www.youtube.com/embed/pBFQdxA-apI?autoplay=1 net::ERR_FILE_NOT_FOUND Somehow after the link is clicked, magnific is not properly handling the url and as a result it is interpreted as a local file.