diff --git a/addons/gst-web/src/input.js b/addons/gst-web/src/input.js index c2262b4f..71094f59 100644 --- a/addons/gst-web/src/input.js +++ b/addons/gst-web/src/input.js @@ -495,8 +495,8 @@ class Input { /** * When fullscreen is entered, request keyboard and pointer lock. */ - _onFullscreenChange(e) { - if (e.matches) { + _onFullscreenChange() { + if (document.fullscreenElement !== null) { // Enter fullscreen this.requestKeyboardLock(); this.element.requestPointerLock(); @@ -540,7 +540,7 @@ class Input { this.listeners.push(addListener(this.element, 'resize', this._windowMath, this)); this.listeners.push(addListener(this.element, 'wheel', this._mouseWheelWrapper, this)); this.listeners.push(addListener(this.element, 'contextmenu', this._contextMenu, this)); - this.listeners.push(addListener(window.matchMedia('(display-mode: fullscreen)'), 'change', this._onFullscreenChange, this)); + this.listeners.push(addListener(this.element.parentElement, 'fullscreenchange', this._onFullscreenChange, this)); this.listeners.push(addListener(document, 'pointerlockchange', this._pointerLock, this)); this.listeners.push(addListener(window, 'keydown', this._key, this)); this.listeners.push(addListener(window, 'keyup', this._key, this));