I've got a page that opens a youtube video with facebox. The facebox
closes correctly but the video doesn't stop playing.

So the sound carries on even if the video isn't visible:

This is the code I've tryed:

        <div id="ytVid" style="display: none">
        <div id="ytapiplayer">
          You need Flash player 8+ and JavaScript enabled to view this
video.
        </div>
        </div>

    <script type="text/javascript">
      // <![CDATA[

      // allowScriptAccess must be set to allow the Javascript from
one
      // domain to access the swf on the youtube domain
      var params = { allowScriptAccess: "always", bgcolor:
"#cccccc" };
      // this sets the id of the object or embed tag to 'myytplayer'.
      // You then use this id to access the swf and make calls to the
player's API
      var atts = { id: "myytplayer" };
      swfobject.embedSWF("http://www.youtube.com/v/ma9I9VBKPiw?
border=0&amp;enablejsapi=1&amp;playerapiid=ytplayer",
                         "ytapiplayer", "425", "344", "8", null, null,
params, atts);


          $(document).bind('close.facebox', function() {
                        document.getElementById("myytplayer").stopVideo();
          })

      //]]>
    </script>

Reply via email to