Vimeo 嵌入 Squarespace:加载时隐藏控件,悬停时显示

Vimeo embed on Squarespace: hide controls on load, show on hover

这里是 Squarespace、Vimeo 和 iFrame 的新用户。我正在为一个 non-profit 做一些工作,他们要求我创建一个包含约 10 个视频的 "Testimonials" 页面,其中每个视频的控件仅在悬停时显示。

加载/非活动状态

视频加载时,不应有任何控件;分享;或 title/byline 可见。

悬停

悬停时,用户应该会看到播放器控件。

我试过的

给定基本的 iFrame 嵌入代码:

<iframe src="https://player.vimeo.com/video/58659769" width="640" height="360" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>

我知道这在 Vimeo 开发方面是可行的,因为所需的事件在我开始播放视频时发生。暂停正在播放的视频后,控件会消失,然后在将鼠标移到视频上时重新出现。

我能找到的最接近的东西是使用 Frogaloop (https://forum.webflow.com/t/play-vimeo-video-on-hover-from-a-cms-collection/78458)。但是,鉴于 JavaScript 限制,我不知道如何在 Squarespace 中执行类似的操作。

信用

视频剧照仅供测试,因为我知道它是上传给拥有 Vimeo Plus 帐户的用户的。感谢 Bianca Giaever! https://vimeo.com/58659769

我能够与 @VimeoStaff Twitter 帐户上的人们联系,他们为我提供了以下答案。 TL;DR:我尝试做的事情是不可能的,但有一些(次优的)解决方法。

As you've found, you can control settings individually (such as the title and byline) within the Embed tab of your video settings page.

I'm afraid it's not possible to change anything mid-load in JS, meaning you won't be able to load the player with no controls and then activate them with a hover. We're so sorry for any inconvenience! I'll be sure to extend this feedback to our product team.

It is possible to remove the playbar from your embedded videos. You can enable this feature by adding the ?background=1 parameter to the end of the player URL in your embed code, for example:

<iframe src="https://player.vimeo.com/video/76979871?background=1"
width="640" height="360" frameborder="0" allow="autoplay; fullscreen"
allowfullscreen></iframe>

Adding this parameter will have the following effect:

  • All player toggles and elements will be turned off (including the play/pause button!)
  • The video will automatically loop.
  • The video will be set to autoplay
  • The video will be muted

If you would simply like to hide the UI of the player without muting/autoplaying/looping (i.e for a chromeless player), you can alternatively add the controls=0 to the end of the player URL in your embed code, for example:

<iframe src="https://player.vimeo.com/video/76979871?controls=0"
width="640" height="360" frameborder="0" allow="autoplay; fullscreen"
allowfullscreen></iframe>

When using the controls embed parameter, you'll need to either enable autoplay (?autoplay=1), use keyboard shortcuts, or implement our player SDK to start and control playback.

More information on background and chromeless videos can be found here. Please note that keyboard shortcuts cannot be disabled currently.

Additionally, I can see you've mentioned having multiple videos on one page. If you have more than one video autoplaying on a particular page, you will also need to include this parameter: autopause=0