arn7av / esl-facebook-stream

ESL Facebook stream client
https://esl.atx.sx
MIT License
27 stars 7 forks source link

Hide controlBar after mouse leaves video element in theatre mode #13

Open jpjagt opened 6 years ago

jpjagt commented 6 years ago

In theatre mode, it would be nice if the controlBar gets hidden when the mouse isn't moving/outside of the video element, preferably with a small delay (+-0.5s) after the last mouse activity.

This behaviour is already natively implemented in fullscreen mode, so one possibility is to adapt from that code.

Custom JS could also be written, and could look something like the code below (using jQuery). This still needs a check whether theatre mode is toggled on.

// hide video controls when not on the video, but not on mobile
var delay = 500; // ms
var $videoControls = // jquery controlBar selector
var $videoContainer = // jquery video container selector

if (window.innerWidth > 450) {
  $videoContainer.mouseenter(function() {
    $videoControls.fadeIn(200);
  });
  $videoContainer.mouseleave(function() {
    setTimeout(function() { $videoControls.fadeOut(200) }, delay);
  });
}