Video.js plugin play in full screen automatically when video is played


I am trying to build a workflow where when I click a “watch video” button, a code in javascript is run and it opens the Video.js Plugin youtube video automatically in fullscreen mode.

Any ideas on what would be the javascript code to put here?

I think it would be something like:

But what do I should put instead of “elem”? How can I identify the video.js player tu put it there?

Hi @pachocastillosr

elem.requestFullscreen() is the correct method to use for that, but where you specify “elem”, you’d need to find the actual elementID which the plugin has created for it to work I believe. If you’re using the free version of the VideoJS plugin, those element ID’s will start with “videoElement_” and then have a random number appended to it and running something like this in the console will make it work… (so long as you can get at your video ID)


But you need to find a way of getting that ID programmatically. If you only have one video on your page then this snippet below may work but it’s not ideal because it goes and finds all VideoJS elements and then runs a method on each, but it might work for you, give it a go anyway!

var allVideos = document.querySelectorAll('[id^=videoElement_][aria-label="Video Player"]');

for (var i = 0; i < allVideos.length; i++) {
    new Function("videojs.players." + allVideos[i].id + ".requestFullscreen();")();


1 Like

Hey Paul! Thanks for your reply, I’ll definitely try it!

I wanted to ask you as well… do you have any ideas on how to make a Search Box search not “accent sensitive”? Let me explain, I am building an app in Spanish (in Spanish, the vocal letters are sometimes written with accent and other times without accent).

Right now, if the user does not type the perfect accents in the search box, they will not find what they are looking for. This is a problem because many people really do not type the accents, but sometimes they do. A dropdown is not the best idea here because they are a lot of options to be displayed.

The letters with their accents are:

If we could just tell the code something like “u”= “u” and “ú”, as well… for all the vocals it would be great!

I attached some images to show you an example of the problem. You will see that the entry with the little red underline is not founded in the other image because the “o” is typed without accent.

I would appreciate any help!



1 Like

No probs. Not sure if you use this or not but there’s a plugin called “Search & Autocorrect” which may do the job for you. Last time I tried it, it worked really well and I see the last update to it says “1.4.1 - Add remove accents / diacritics option (on by default)”

It might help the situation. Failing that, and depending on how you have your entries appearing in the search dropdown I see there, you might be able to get away with using the Find/Replace option a few times in succession to replace those accented characters before they’re passed to the search? Not sure without having a good play.

1 Like