Pause Vimeo video when page in in an iframe

Im using this script to pause vimeo and it works fine until the exported page is in an iframe. Is there a way around it?
The text button on the first page should pause the presenter video
http://elearningproducts.com.au/temp/wai_dining/mm1/

var iframes = document.getElementsByTagName('iframe');
for(var i = 0; i < iframes.length; i++) {
if(iframes[i].src.indexOf('vimeo') != -1) {
var player = new Vimeo.Player(iframes[i]);
player.pause();
}
}

As long as that code is included within the same page (like still in your iframe) then I would think it would work.

About my only guess would be if your <iframe> code had the sandbox attribute and didn't allow-scripts, but I think that would break more than just the vimeo code.

The link you posted, which puts the hype document in an iframe, works for me. Do you have an example of a non-working version?

1 Like

ah yes, that works thanks Jonathan :slight_smile:

1 Like