Pause YouTube embed in iFrame

Send Snippet To: Save this snippet to Code Collector Pro -- view all jared's snippets
language: jQuery (JavaScript)
license: Other

Code for Snippet:

                
/**
 * 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":""}', '*');
	}
}
comments powered by Disqus

Info

Link to this snippet:


Download to Code Collector

To use the direct link to your snippet on CodeCollector.net either copy the html from the above section or drag the Download to Code Collector to where you would like to use it.

More Info:

Times Viewed: 494
Date Added: 2013-07-09 21:18:09
Last Modified: 2013-07-09 15:32:00

Web Analytics