4

Is there a way to detect when a user push the full screen button? Can't find any info about it on their API site...

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

tshepang
  • 11,360
  • 21
  • 88
  • 132
Philip
  • 6,369
  • 12
  • 70
  • 102

3 Answers3

3

I try a lot of time to detect click on fullscreen button on vimeo player, with no success. But i find other solution that work for me:

$(window).resize(checkResize);

function checkResize(){
    if (
        document.fullscreenElement ||
        document.webkitFullscreenElement ||
        document.mozFullScreenElement ||
        document.msFullscreenElement
    ){
        // action for fullscreen enable
    }else{
        // action for fullscreen disable
    }
}
0

This is how I accomplished detecting if embedded (iframe) Vimeo videos were fullscreen or not (requires jQuery):

$(function(){
    var checkVimeoFullscreen = setInterval(function(){
        var winWidth = $(window).width(); // Get the full window width
        var vimeoWidth = $('iframe[src*="vimeo"]').width(); // Get the width of the Vimeo iframe
        if (winWidth == vimeoWidth){ // if the Vimeo iframe and the window width match, you're in fullscreen
            console.log("Vimeo is in fullscreen mode.");
        } else {
            console.log("Vimeo is not in fullscreen mode.");
        }
    },500); // You can change the interval if you want, but this worked for me
});
Loko Web Design
  • 481
  • 4
  • 11
-1

You can do it like this:

$('button.fullscreen[data-title-fullscreen][data-title-unfullscreen]').click(function(){
//DO something here
});
Amit Joki
  • 56,285
  • 7
  • 72
  • 91