如何使视频自动全屏播放

时间:2015-06-08 20:36:06

标签: javascript jquery vimeo vimeo-api vimeo-player

所以我有这个代码来点击按钮播放视频:

<!DOCTYPE html>
<html>
    <body>
        <script src="https://f.vimeocdn.com/js/froogaloop2.min.js"></script>
        <iframe id="player1" src="https://player.vimeo.com/video/76979871?api=1&player_id=player1" width="630" height="354" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

        <script>
        $(function() {
            var iframe = $('#player1')[0];
            var player = $f(iframe);

            // When the player is ready, add listeners for pause, finish, and playProgress
            player.addEvent('ready', function() {
                player.addEvent('pause', onPause);
                player.addEvent('finish', onFinish);
                player.addEvent('playProgress', onPlayProgress);
            });

            // Call the API when a button is pressed
            $('button').bind('click', function() {
                player.api($(this).text().toLowerCase());
            });
        });
        </script>

        <div>
          <button>Play</button>
          <button>Pause</button>
        </div>
    </body>
</html>

当按下播放按钮时,有没有办法让它全屏显示?

0 个答案:

没有答案