Show/Hide Videojs controls at runtime

一个人想着一个人 提交于 2020-08-04 17:44:06

问题


Is there a way to show/hide the video controls on the videojs player at runtime (e.g. player.controls.hide()).
Any ideas how to do this? Thanks!


回答1:


This is how I hide controls after a 1 second mouse inactivity timeout.

    var inactivityTimeout = null;
    $('#vmr_video').mousemove(function(event) {
        player.controlBar.fadeIn();
        if (inactivityTimeout != null) {
            clearTimeout(inactivityTimeout);
        } 
        inactivityTimeout = setTimeout(function(){
            player.controlBar.fadeOut();
            controlBarVisible = false;
        }, 1000);
    });



回答2:


Use player.userActive(false) to hide the controls. You can also listen to useractive and userinactive events on the player to respond to the player's natural showing and hiding of controls.




回答3:


this.player.controls(true) // shows control

this.player.controls(false) // hides control



来源:https://stackoverflow.com/questions/16514054/show-hide-videojs-controls-at-runtime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!