jgubman / videojs-theater-mode

Adds a "theater-mode" class to a passed in DOM element so apps can define theater mode in their local CSS
MIT License
12 stars 10 forks source link

Change Button Placement #2

Open casbboy opened 7 years ago

casbboy commented 7 years ago

How do you change the tab order or button placement?

I tried this without success: var toggle =

player.controlBar.addChild('theaterModeToggle', options, 4);

Didn't work.

It is placing the button close to progress bar and far from the fullscreen button, which I'd like it to sit right in front of.

How can I move it or tell it to go before the fullscreen button?

jgubman commented 7 years ago

Hey @casbboy, do you have a page or anything up that shows the problem? I built the plugin against video.js 5, and notice you're using video.js 6 syntax for the #addChild function. The indexopt (4) wasn't available when originally built, so this line is responsible for placing the theater mode button just before the fullscreen button:

https://github.com/jgubman/videojs-theater-mode/blob/master/src/videojs.theaterMode.js#L49

Here's what it's supposed to look like: video.js 6.2: https://jsfiddle.net/qwv0n9m3/2/ video.js 5.19: https://jsfiddle.net/qwv0n9m3/

casbboy commented 7 years ago

Hey @jgubman - It turns out a skin I had wasn't completing before running yours, so the skin had the same line for two other buttons, and so they'd get priority since would run after the theater mode button.

The skin has since added a "finished" trigger, so I wait for that and then run the theatermode.

I used to have my expand player function inside this:

player.on('theaterMode', function(elm, data) {
    if (data.theaterModeIsOn) {
      expandtaplayer();
    } else {
     expandtaplayer();
    }

But it would run upon load every time, so deleted the above and just went with....

$(document).on('click', ".vjs-theater-mode-control-open,.vjs-theater-mode-control-close", function() {
              expandtaplayer();
              });

Since that single function checks whether expanded or not yet.

Cheers! Ryan

casbboy commented 7 years ago

You can see the theater mode button in action here: https://www.traileraddict.com/thor-ragnarok/feature-trailer