edtheprogrammerguy
edtheprogrammerguy

Reputation: 6039

Show/Hide Videojs controls at runtime

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!

Upvotes: 7

Views: 16865

Answers (3)

Ranjeet Eppakayala
Ranjeet Eppakayala

Reputation: 3028

Dynamically shows / hide control

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

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

Upvotes: 4

Tamlyn
Tamlyn

Reputation: 23554

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.

Upvotes: 7

Rori Stumpf
Rori Stumpf

Reputation: 1977

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);
    });

Upvotes: 6

Related Questions