Pause youtube video when slide the next item
<p>I am using bootstrap slider on my page. I need to pause the currently playing video when slider moves to the next one.
I tried using youtube callback but it doesnt seems like working, may be my way of applying is not right.</p>

<p>here is what I have used</p>

<pre><code>jQuery(function ($) {
        $('div.carousel-inner div.active').attr('id', 'current');
    });

    function callPlayer(frame_id, func, args='') {

        if (window.jQuery &amp;&amp; frame_id instanceof jQuery) frame_id = frame_id.get(0).id;
        var iframe = document.getElementById(frame_id);
        if (iframe &amp;&amp; iframe.tagName.toUpperCase() != 'IFRAME') {
            iframe = iframe.getElementsByTagName('iframe')[0];
        }
        if (iframe) {
            iframe.contentWindow.postMessage(JSON.stringify({
                "event": "command",
                "func": func,
                "args": args || [],
                "id": frame_id
            }), "*");
        }

        jQuery(function ($) {
            $('div.carousel-inner div.item').attr('id', '');
            $('div.carousel-inner div.active').attr('id', 'current');
        });
    }
</code></pre>

<p><strong><a href="http://jsfiddle.net/2q99udgk/401/" rel="nofollow">Demo</a></strong></p>