Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pause YouTube embed in iFrame
/**
* iFrame Must have '&/?enablejsapi=1'
*
* @param slideIndex
*/
function pauseVideoOnSlide(slide)
{
var iframe = $(slide).find("iframe")[0];
if (iframe) {
var target = iframe.contentWindow;
target.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.