dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.39k stars 3.48k forks source link

Youtube link does not load using t parameter in url #1144

Open samdenis516 opened 4 years ago

samdenis516 commented 4 years ago

I am getting a "youtube refused to connect" when i add the t paremeter to my youtube url. ex Open YouTube video

pirco commented 3 years ago

+1

erredeco commented 3 years ago

the problem is that the parameter ?t=XX should be "translated" into ?start=XX

ardiansyaherwin commented 2 years ago

Hi, has this issue been resolved? above fix, by changing ?t=XX to ?start=XX is not working

matzeeable commented 3 months ago

Running into the same issue, especially as described in #1162:

ie. https://www.youtube.com/watch?v=MEDXwwDeP5o works but https://www.youtube.com/watch?v=MEDXwwDeP5o&t=293s does not

This is caused by the way how magnificPopup extracts the YouTube ID from the URL, as it uses the rest of the string after v=:

https://github.com/dimsemenov/Magnific-Popup/blob/45dd72ccd1a18f0626fb958f7c49e6313556d31f/src/js/iframe.js#L80

So, https://www.youtube.com/watch?v=MEDXwwDeP5o&t=293s gets converted to //www.youtube.com/embed/MEDXwwDeP5o&t=293s?autoplay=1, the ? for URL query arguments is placed wrong.

In https://github.com/dimsemenov/Magnific-Popup/pull/213#issuecomment-27205972 a solution through regular expression was already suggested, which would solve the issue.