如何在查询时自动播放 vimeo 视频?

how to play the vimeo video on query automatically?

一开始,视频播放,但它停止了。 我想在浏览器启动时播放视频。

 <html>
  <head></head>
    <body>
        <!-- NOTE: ?api=1 and player_id at the end of the URL -->
            <iframe id="player" width="" height="" src="http://player.vimeo.com/video/62207569?api=1&player_id=player" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>

            <script src="http://a.vimeocdn.com/js/froogaloop2.min.js"></script>

            <script>    
                var player = $f(document.getElementById('player'));
                player.addEvent('ready', function() { 
                player.api('play');
                });
            </script>
    </body>
</html>

froogaloop2 js 不工作现在尝试使用 player.vimeo.com/api/player.js.
就这样试试

<iframe id="player" width="" height="" src="http://player.vimeo.com/video/62207569?api=1&player_id=player" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>

<script src="https://player.vimeo.com/api/player.js"></script>
<script>
    var frame = document.querySelector('iframe');
    var jqueryPlayer = new Vimeo.Player(frame);
    jqueryPlayer.play();
    console.log('played the video!');
</script>

我有运行这段代码,只需检查输出

您可以参考这篇https://github.com/vimeo/player.js#create-a-player了解更多详情。