Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop Vimeo embeds on previous / next buttons within Jquery Infinite Carousel

My setup: http://jsfiddle.net/ASa2K/1/

I have a Jquery Infinite Carousel which will have in it embedded Vimeo vids.

When 'Next' or 'Prev' is clicked, I would like it to stop all videos. Currently it keeps playing the videos while clicking through.

I've looked around but can't find much specific to my problem. I'm not so well-versed in js as you might have guessed!

like image 584
xhadf Avatar asked Dec 12 '22 08:12

xhadf


1 Answers

Hej so first of you can find the api here

http://vimeo.com/api/docs/player-js

since its an iframe there is no back compatible way of communicating with it but there is something called postMessage that new browsers has. so You can write this.

$("iframe").each(function() {
  this.contentWindow.postMessage('{ "method": "pause" }', "http://player.vimeo.com");
});

the different methods are documented on the page. but this pauses all players.

like image 171
megakorre Avatar answered Feb 01 '23 22:02

megakorre