tags:

views:

2043

answers:

5

How must the code below be changed to embed this YouTube with sound off?

<embed src="http://www.youtube.com/v/etnh6_omu0w&amp;hl&amp;rel=1&amp;autoplay=1&amp;sound=1" type="application/x-shockwave-flash" 
allowscriptaccess="always" allowfullscreen="true" width="200"></embed>
+10  A: 

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&amp;hl&amp;enablejsapi=1&amp;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

shady
A: 

I copied your code as is and played with the mut parameter every way I could think of, but the sound keeps playing. I also deleted the cache each time and viewed source.

I can't believe this difficult! Thx.

This is true. Looking at the youtube documentation there's no mute param as I thought. You must use the youtube API. I will paste code in two minutes showing it's proper use. I apologize.
shady
Ok I edited my post, that's the youtube player javascript API very simple interface should be a snap to put it your code and you can do alot of other neat stuff with it.
shady
A: 

It works!

Thx a million.

No problem man! Happy to do it...
shady
A: 

It doesn't work in my web browsers. It said my flash player should be version 8+ But I was using flash player 9 with javascript on. I tested on both Firefox 3.11 & IE 7.

I realize, the flash player's support on Firefox is a little bit buggy (update the player several times), some flash movie may still not appear (blank), but on IE it should work fine. But not in your sample code.. Correction: it works on my IE 7. But not in Firefox 3.11. I wonder, why flash player / SWFObject not getting along with recent firefox. Do you have any tweak or recommendation can be done to make Firefox 3 plays all swf well?

To be honest I'm really not sure. I would check the google code forums for answers to that question. Sorry I can't be more help. Maybe you should create a new question and see if anyone else can help?
shady
A: 

We've just used it at login.debt-line.org.uk, the code is really good however at the of the video it shows adds! Does any one know how to disable this?

I have done some cracking heat map trickery as well at http://login.debt-line.org.uk/creditors, check it out. seriously, its sweet.

adam coller