I'm having problems with having both rel=0 and autoplay=1 added in a YouTube embedded player in a magnific popup.
It seems like it is only the first parameter in the url that is working, and i have tried all these versions:
?rel=0&autoplay=1
?rel=0&autoplay=1
?rel=0?autoplay=1
None of them are working. But if I move autoplay=1 up as the first parameter, then the autoplay works fine - but then the rel=0 doesn't.
Here's my code.
HTML:
<a class="video1" href="https://www.youtube.com/watch?v=_ziUhNerFMI?rel=0&autoplay=1"></a>
CSS:
.video1 {
background-image: url('http://placehold.it/180x180');
background-repeat: no-repeat;
background-size: contain;
height: 180px;
width: 180px;
display: block;
outline: none;
}
JS:
jQuery(document).ready(function ($) {
$('.video1').magnificPopup({
type: 'iframe',
iframe: {
markup: '<?php echo $first; ?>'+
'<div class="mfp-iframe-scaler">'+
'<div class="mfp-close"></div>'+
'<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+
'</div>'
},
callbacks: {
markupParse: function(template, values, item) {
values.title = item.el.attr('title');
}
}
});
});