how to automatically start youtube video in iframe without being autoplay? [closed]

-9

How could I do this in this code?

<iframe width="420" height="345" src="https://www.youtube.com/embed/Y3wtmZ4Ds3M?autoplay=1"frameborder="0" allowfullscreen></iframe>

no matter the programming language

    
asked by anonymous 10.03.2017 / 20:57

1 answer

4

If the intention is to monetize

Although it is possible to force the play by pretending that it was a human who clicked play to monetize YouTube, you will know the difference, Google is the creator of reCaptcha and now reCaptcha "invisible" , you really think would be able to circumvent something that an entire company with several professionals created to avoid? I do not think so.

This is clearly a security to prevent false clicks and they are correct in doing this, the intention to watch the video has to come from the user.

For other uses

Hap here This video worked normally, but the alternative would be to use the Youtube API , like this:

<!DOCTYPE html>
<html>
  <body>
    <div id="player"></div>

    <script>
    (function () {
        var player;

        window.onYouTubeIframeAPIReady = function() {
            player = new YT.Player('player', {
                height: '390',
                width: '640',
                videoId: 'M7lc1UVf-VE',
                events: {
                    'onReady': onPlayerReady
                }
            });
        };

        // 4. Executa o play quando o video estiver pronto
        function onPlayerReady(event) {
            event.target.playVideo();
        }

        var tag = document.createElement('script');

        tag.src = "https://www.youtube.com/iframe_api";
        var firstScriptTag = document.getElementsByTagName('script')[0];
        firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
    })();
    </script>
  </body>
</html>
    
10.03.2017 / 21:19