Home > database >  Change videojs options from the developer's console
Change videojs options from the developer's console

Time:09-05

During testing my script it would be very convenient to change an option from the Google Chrome developer's console. For example, I wish to change the controlBar option. Can I do it? Thanks!

CodePudding user response:

There are a number of ways you could do this. If you just want to hide the Control Bar, you can edit the DOM in the Chrome inspector and remove the element, or hide it with CSS.

If you want to do it more programmatically, your best option would be to make your player object available on the window, and then you can easily manipulate it there during testing.

In your code:

window.myVideoJsPlayer = this.player_;

In the dev console:

window.myVideoJsPlayer.controls(false))

Note that you may only want to expose your player on the window like this during testing, rather than on production - depends on the context.

  • Related