Hi,
Usually people say the opposite: piece of cake with Vimeo, Hell on Earth with Youtube
I wouldn’t know I’m not a coder. But I have a WF site in dev working with the Vimeo API. My associate wrote the code for it, I’m going to track it down and paste it below. We use it to open the targeted video, and to automatically stops the playing when you close a popup so you don’t end up having tons of videos loading and playing at the same time.
On the <head>
we have:
<script src="//f.vimeocdn.com/js/froogaloop2.min.js"></script>
Before we have:
<script>
jQuery(function() {
var $ = jQuery, player,
vimeoBase = '//player.vimeo.com/video/';
$(document)
.on('click', '.close-video-button', function () {
var iframe = getIframeJQElement()[0];
player = $f(iframe);
if(!player) return;
player.api('unload');
})
.on('click', '.badge', function(e) {
var iframe = getIframeJQElement(),
url = $(this).find('.link-film').attr('href'),
playerUrl = getPlayerUrl(url, $(iframe).attr('src'));
$(iframe).hide().attr('src', playerUrl);
e.preventDefault();
});
getIframeJQElement().on('load', function() {
$(this).show();
})
function getPlayerUrl(href, src) {
var matchVimeo = href.match(/vimeo.com\/(\d+)$/);
if(!matchVimeo) return src;
var vid = matchVimeo[1],
params = src.split('?');
return vimeoBase + vid + (params.length > 1 ? '?' + params[1] : '?api=1' );
}
function getIframeJQElement() {
return $('.video-player').find('iframe');
}
});
</script>
In the site designer, the video is simply declared on a link block:
http://vincent.polenordstudio.fr/snap/qf6h0.jpg
There’s a unique interaction, opening a unique popup, for every badges elements:
http://vincent.polenordstudio.fr/snap/bosg7.jpg
The video player popup contains a classic custom code for a Vimeo player, inside a custom code Webflow widget. Whatever the video used for this custom player code, it’s not important, as the JS is going to rewrite that part with the link you set on the badge, before the popup appears:
http://vincent.polenordstudio.fr/snap/40lil.jpg
Hope this helps. Can’t share the actual site sorry.