Skip to content

Commit

Permalink
Merge pull request #3536 from jwplayer/bugfix/autohide_controls_on_mo…
Browse files Browse the repository at this point in the history
…bile

[JW8-10549] Fix the controls not autohiding on mobile
  • Loading branch information
mamaddox committed Nov 26, 2019
2 parents 6cccfca + 5c6baa3 commit 0070a2f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/js/view/view.js
Expand Up @@ -98,7 +98,7 @@ function View(_api, _model) {
}

function fosMobileBehavior() {
return OS.mobile && !deviceIsLandscape();
return _isMobile && !deviceIsLandscape();
}

// Compute player size, handle DOM removal/insertion, add to views-manager
Expand Down Expand Up @@ -354,7 +354,7 @@ function View(_api, _model) {
_lastWidth = _lastHeight = null;

// Setup floating scroll handler
if (_floatingConfig && OS.mobile) {
if (_floatingConfig && _isMobile) {
viewsManager.addScrollHandler(throttledMobileFloatScrollHandler);
}

Expand Down Expand Up @@ -460,9 +460,6 @@ function View(_api, _model) {
}
},
tap: () => {
_playerElement.removeEventListener('mousemove', moveHandler);
_playerElement.removeEventListener('mouseout', outHandler);
_playerElement.removeEventListener('mouseover', overHandler);
_this.trigger(DISPLAY_CLICK);
if (settingsMenuVisible()) {
_controls.settingsMenu.close();
Expand Down Expand Up @@ -499,10 +496,12 @@ function View(_api, _model) {
},
doubleClick: () => _controls && api.setFullscreen()
});

_playerElement.addEventListener('mousemove', moveHandler);
_playerElement.addEventListener('mouseover', overHandler);
_playerElement.addEventListener('mouseout', outHandler);

if (!_isMobile) {
_playerElement.addEventListener('mousemove', moveHandler);
_playerElement.addEventListener('mouseover', overHandler);
_playerElement.addEventListener('mouseout', outHandler);
}

return clickHandler;
}
Expand Down Expand Up @@ -1108,7 +1107,7 @@ function View(_api, _model) {
this.resizeListener.destroy();
delete this.resizeListener;
}
if (_floatingConfig && OS.mobile) {
if (_floatingConfig && _isMobile) {
viewsManager.removeScrollHandler(throttledMobileFloatScrollHandler);
}
};
Expand Down

0 comments on commit 0070a2f

Please sign in to comment.