Best Answer eric, 15 September 2014 - 02:38 PM
What's happening is that while you are hiding the video, the actual <iframe> is still present and playing on the page. Pausing the video can be a little tricky, but is certainly doable using the YouTube iframe API. In your case, something like this might work:
$('.close-video').click(function( e ){
e.preventDefault();
$('#feat-video').fadeOut(500);
var iframeId = $('#feat-video').find('iframe:first').attr('id'),
player = new YT.Player(iframeId);
player.stopVideo();
});
(Haven't tested this code but it should work fine when using TubePress Pro). As you can see we are finding the <iframe>, grabbing its dom ID, then creating a YouTube player object out of it. Then it's just a matter of calling stopVideo() on the player.
Hope that points you in the right direction?
Go to the full post









