Vimeo,检测全屏点击

4

@AmitJoki 当然可以! - Philip
4个回答

3

我尝试多次在Vimeo播放器上检测全屏按钮的点击,但没有成功。 但是我找到了另一种对我有效的解决方案:

$(window).resize(checkResize);

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

0
检查下面的代码,监听屏幕大小调整事件,然后检查文档是否处于全屏模式,如果是,请执行您想要的操作(例如将屏幕旋转为横向)。
                        window.addEventListener('resize', function () {
                    if (
                        document.fullscreenElement ||
                        document.webkitFullscreenElement ||
                        document.mozFullScreenElement ||
                        document.msFullscreenElement
                    ){
                        screen.orientation.lock('landscape');
                    }
                });

0
这是我如何检测嵌入(iframe)Vimeo视频是否全屏的方法(需要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
});

-1
你可以这样做:
$('button.fullscreen[data-title-fullscreen][data-title-unfullscreen]').click(function(){
//DO something here
});

你有权限访问它吗? - Amit Joki
iframe 是 vimeo 的电影。嵌入式的。 - Philip

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接