我如何使用新的 (2016) Vimeo javascript API 开始制作视频?

How can I use the new (2016) Vimeo javascript API to start a video?

Vimeo 有一个 new (2016) javascript API。我正在寻找一个 基本示例 用于 在单击页面上的某些内容时 javascript 启动和停止视频 .

我发现那两篇文章涵盖了这些主题,但都是关于旧的 frogaloop api:

要通过新的 javascript API 启动 Vimeo 视频,您只需在页面中包含 API,然后执行 play 方法。请参阅下面的示例:

<!-- Load the video iframe. Be sure to not forget to enable the api (api=1) -->
<iframe src="https://player.vimeo.com/video/87982573?api=1" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

<!-- When clicking this text the video will start -->
<p id='start'>click to start</p>

<!-- Including jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Including Vimeo player javascript API -->
<script src="https://player.vimeo.com/api/player.js"></script>
  
<script>
  var iframe = document.querySelector('iframe');
  var player = new Vimeo.Player(iframe);
  // Execute the `play` method of the API when something with id start is clicked
  $('#start').click( function() {
    player.play();
  });
</script>

一定要看看Vimeos example page for the new player API