问题
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