I would like to load an embedded youtube video when the cursor hovers over a div with the video muted. I got the "mouse enter" part working and the video loads properly. But I couldn't get the video to mute... Please help!
I'm using the following to load an embedded youtube video on mouseenter, which works fine:
HTML
<div class="featured desktop_only">
<a href="#">
<div class="video_block shadow id1">
<img src="http://img.youtube.com/vi/mzygYS-vN1E/maxresdefault.jpg" />
<div class="info">
<span>Mary Chan</span>
<h2>In vestibulum elementum nisl quis maximus</h2>
<p>
Mei novum propriae ne, adhuc option ei nec. Cu vix accusam persequeris, etiam alienum sed cu. Ex qui eius oblique salutandi. Et vis adolescens cotidieque, ut veri vidit sed. Cu meis movet oblique pri, usu an malis iriure detracto.
</p>
<div class="spec">
Wednesday, July 28, 2015<br>
10:52 ยท 3,450 Views
</div>
</div>
<div class="preview"></div>
</div>
</a>
</div>
jQuery
$('.video_block.id1').mouseenter(function() {
$('.video_block.id1 .preview').html('<iframe id="ytplayer" type="text/html" src="https://www.youtube-nocookie.com/embed/scqYWrcwp_s?rel=0&autoplay=1&controls=0&showinfo=0&loop=1&iv_load_policy=3&enablejsapi=1" frameborder="0" allowfullscreen></iframe>');
});
$('.video_block.id1').mouseleave(function() {
$('.video_block.id1 .preview').html('');
});
I've tried the suggestions on the following question but it doesn't seem to be work once I couple it with the mouse enter: How do you mute an embedded Youtube player?
Also note that I plan to have multiple divs to hover on and load different videos for each, but only one will play each time.
Thanks in advance!