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...
Asked
Active
Viewed 2,766 times
4
-
@AmitJoki Absolutely! – Philip Mar 21 '14 at 12:43
3 Answers
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
}
}
Massimo Danno
- 31
- 2
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