Added 'doubleClickForFullscreen' config to UI.

This configuration, which is true by default, lets a user optionally
disable the "go fullscreen on double-click" functionality.
This allows a developer to fully disable fullscreen mode, if they so
wish, or to retain the fullscreen button but disable other methods of
entering fullscreen.

Issue #2459

Change-Id: I196602fc9843e0fd799c78703de60f864e906841
This commit is contained in:
Theodore Abshire
2020-03-16 08:58:18 -07:00
parent 935040a3b5
commit d1dce29e89
4 changed files with 20 additions and 3 deletions
+8
View File
@@ -187,6 +187,7 @@ describe('UI', () => {
overflowMenuButtons: [
'quality',
],
doubleClickForFullscreen: false,
};
const ui = UiUtils.createUIThroughAPI(videoContainer, video, config);
const controls = ui.getControls();
@@ -195,6 +196,13 @@ describe('UI', () => {
const controlsContainer =
videoContainer.querySelector('.shaka-controls-container');
// When double-click for fullscreen is disabled, it shouldn't happen.
UiUtils.simulateEvent(controlsContainer, 'dblclick');
await Util.shortDelay();
expect(spy).not.toHaveBeenCalled();
// Change the configuration and try again.
config.doubleClickForFullscreen = true;
(/** @type {!shaka.ui.Overlay} */ (ui)).configure(config);
UiUtils.simulateEvent(controlsContainer, 'dblclick');
await Util.shortDelay();
expect(spy).toHaveBeenCalledTimes(1);