Hi everyone,

I tried to embed a video from YOUTUBE to my website with autostart. The suggested code is

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/52_wba_dzKs&hl=en&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/52_wba_dzKs&hl=en&fs=1&rel=0" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>

I modified it

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/52_wba_dzKs&hl=en&fs=1&rel=0"></param>
<param name="allowFullScreen" value="falce"></param>
<param name="allowAutoPlay" value="true"></param>
<embed src="http://www.youtube.com/v/52_wba_dzKs&hl=en&fs=1&rel=0" type="application/x-shockwave-flash" allowfullscreen="falce" allowAutoPlay=”true” width="425" height="344"></embed></object>

But it is not working. Again have to click over the button to start video.
Any advice? I’m using IE 7.0 browser.

By the way I tried to create parameter AutoStart with the same negative success.

Alex

Dani AI

Generated

Short summary: was right — autoplay is a player URL / query-string parameter, so adding &autoplay=1 to the src (or iframe src) is the correct quick fix. Putting a nonstandard <param name="allowAutoPlay"> in the object/embed block will not be interpreted by YouTube’s player. (Note: ’s second snippet also had allowFullScreen="falce", which is just a typo and would not help.) (developers.google.com)

Longer-term note: the classic object/embed (Flash) approach was common in 2008, but Flash has been retired and blocked by browsers since 2020 — migrate to the IFrame/HTML5 player to keep embeds working and maintainable. (adobe.com)

Browser caveat and reliable approach: modern browsers often block autoplay with sound. Muted autoplay is usually allowed; autoplay with sound typically requires prior user interaction or specific browser heuristics. For a robust solution use an iframe embed plus the YouTube IFrame Player API so the player can be muted programmatically before calling play. Minimal examples (replace VIDEO_ID and origin):

<iframe id="ytplayer" width="640" height="360"
  src="https://www.youtube.com/embed/VIDEO_ID?autoplay=1&origin=https://example.com"
  allow="autoplay; encrypted-media" allowfullscreen></iframe>
<script src="https://www.youtube.com/iframe_api"></script>
<div id="player"></div>
<script>
  function onYouTubeIframeAPIReady() {
    new YT.Player('player', {
      height: '360', width: '640', videoId: 'VIDEO_ID',
      playerVars: { autoplay: 1, controls: 1 },
      events: {
        onReady: function(e) {
          e.target.mute();
          e.target.playVideo();
        }
      }
    });
  }
</script>

These behaviors and the API methods are documented by browser and YouTube docs. (developer.mozilla.org)

Quick troubleshooting checklist: confirm the uploader hasn’t disabled embedding or applied age restrictions (those prevent playback in embeds), test with extensions/ad‑blockers turned off, include an origin parameter if embedding cross‑origin, and watch the console for rejected play() promises or autoplay-block events. The &autoplay=1 fix explained in the thread was correct for the Flash-era embed; today the iframe + API approach is the recommended, supported path. (stackoverflow.com)

Recommended Answers

All 2 Replies

Thanks! It is working perfect!

Sorry it is stupid but I was forgot for that option. I was thinking to do it only by parameters. The possibility to manipulate autoplay by the code in src line completely go off my brain! Thank you very much!

Alex

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.