jaruba / wcjs-player

Node Player made for WebChimera.js (libVLC wrapper)
http://webchimera.org/
GNU Lesser General Public License v2.1
178 stars 46 forks source link

If you press ESC to exit full screen, the full screen button cannot be used #80

Open zgangjin opened 7 years ago

zgangjin commented 7 years ago

If you press ESC to exit full screen, the full screen button cannot be used

ondrejpaluch commented 7 years ago

I had the same problem. I fixed it like this:

var wjs = require("wcjs-player");

var player = new wjs("#player").addPlayer({
  autoplay: true,
  wcjs: require('wcjs-prebuilt')
});

var onFullScreenChange = function ( event ) {
    var isFullScreen = ( 
        document.fullscreenElement != null || document.webkitFullscreenElement != null
    );

    if ( !isFullScreen ) {
        player.find(".wcp-minimize").removeClass("wcp-minimize").addClass("wcp-maximize");
    }
}; 

document.addEventListener("fullscreenchange", onFullScreenChange);
document.addEventListener("webkitfullscreenchange", onFullScreenChange);