/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script src="http://www.google.com/jsapi"></script> <script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script> <div id="ytapiplayer">You need Flash player 8+ and JavaScript enabled to view this video.</div> <script type="text/javascript"> google.load("swfobject", "2.1"); function onYouTubePlayerReady(playerId) { ytplayer = document.getElementById("myytplayer"); ytplayer.playVideo(); ytplayer.mute(); } var params = { allowScriptAccess: "always" }; var atts = { id: "myytplayer" }; swfobject.embedSWF("http://www.youtube.com/v/J2hqhNhAj_g?enablejsapi=1&playerapiid=ytplayer&allowFullScreen=true&version=3", "ytapiplayer", "425", "356", "8", null, null, params, atts); </script>
URL: http://www.faisalkaleem.com/api/how-to-autoplay-a-youtube-video-in-mute-using-js-api.html