Embed YouTube with sound off

audio, youtube

Solution

Here's the code as it should be:

you'll need to include this as well in the same folder this code is in:

SWFObject.js

That's just some helper code, I wouldn't worry about it.

code:

  <script type="text/javascript" src="swfobject.js"></script>    
  <div id="ytapiplayer">
    You need Flash player 8+ and JavaScript enabled to view this video.
  </div>

  <script type="text/javascript">

    var params = { allowScriptAccess: "always" };
    var atts = { id: "myytplayer" };
    swfobject.embedSWF("http://www.youtube.com/v/FSz_a_yx9hA&hl&enablejsapi=1&playerapiid=ytplayer", 
                       "ytapiplayer", "425", "356", "8", null, null, params, atts);

    function onYouTubePlayerReady(playerId) {
        ytplayer = document.getElementById("myytplayer");
        ytplayer.mute();
    }

  </script>

Ok I tested that code and I know it works so if you have any problems let me know, happy hacking!

Get the docs here: YouTube Embedded Player Javascript API Reference

Problem

How must the code below be changed to embed this YouTube with sound off? ``` <embed src="http://www.youtube.com/v/etnh6_omu0w&hl&rel=1&autoplay=1&sound=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="200"></embed> ```

Original source