There is anyway to delay the auto start of a youtube video clip for example:\" 20seconds, after web page loads?\"

Here is the instance just through the auto start:

http://jsfiddle.net/qbqEA/

Thanks


\"*\"

The best way to do it is to usage YouTube.API v Javascript functionality.

// fill the IFrame Player API code asynchronously. SetTimeout(function() player.playVideo(); , 20000); var sign = document.createElement(\"script\"); tag.src = \"https://www.youtube.com/player_api\"; var firstScriptTag = document.getElementsByTagName(\"script\")<0>; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); // change the \"ytplayer\" aspect with an and also // YouTube player after ~ the API code downloads. Var player; function onYouTubePlayerAPIReady() player = brand-new YT.Player(\"ytplayer\", height: \"315\", width: \"560\", videoId: \"I_V_kIzKKqM\" ); I hope this help


\"*\"

The attach to the IFrame YouTube API over is obsolete, i think, but here\"s one I found today:

https://developers.google.com/youtube/iframe_api_reference

Wish I\"d read that a lengthy time ago.

You are watching: Youtube delay before video starts

To excerpt indigenous the example there, i would imply that you detect the player gift downloaded and also ready, then collection a timer for the desired variety of seconds (20 in your case, i think), and then play the video.

---v


\"*\"

Using https://developers.google.com/youtube/iframe_api_reference this will include a 10 second hold-up before the video clip automatically starts:


\"*\"

jQuery(document).ready(function () var structure = jQuery(\".embed-responsive iframe\"); var src = frame.attr(\"src\"); setTimeout(function() frame.attr(\"src\", src+\"?autoplay=1\"); , 20000););

Thanks because that contributing solution to stack Overflow!

Please be certain to answer the question. Administer details and share her research!

But avoid

Asking because that help, clarification, or responding to other answers.Making statements based upon opinion; earlier them up with references or personal experience.

See more: Onkyo Tx-Sr604 - Onkyo Tx Sr604 7

To discover more, watch our advice on writing great answers.


short article Your answer Discard

By clicking “Post her Answer”, girlfriend agree come our regards to service, privacy policy and cookie plan


Not the prize you're spring for? Browse various other questions tagged javascript youtube youtube-api or questioning your very own question.


What is the explanation for these bizarre JavaScript behaviours pointed out in the 'Wat' talk for CodeMash 2012?
site architecture / logo © 2021 stack Exchange Inc; user contributions licensed under cc by-sa. Rev2021.9.21.40254


your privacy

By click “Accept every cookies”, you agree ridge Exchange deserve to store cookie on your maker and disclose information in accordance with our Cookie Policy.