mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-14 15:56:38 +03:00
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:
@@ -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);
|
||||
|
||||
Vendored
+5
-2
@@ -854,8 +854,11 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
|
||||
// for focused elements.
|
||||
this.eventManager_.listen(window, 'keydown', (e) => this.onKeyDown_(e));
|
||||
|
||||
this.eventManager_.listen(
|
||||
this.controlsContainer_, 'dblclick', () => this.toggleFullScreen());
|
||||
this.eventManager_.listen(this.controlsContainer_, 'dblclick', () => {
|
||||
if (this.config_.doubleClickForFullscreen) {
|
||||
this.toggleFullScreen();
|
||||
}
|
||||
});
|
||||
|
||||
this.eventManager_.listen(this.video_, 'play', () => {
|
||||
this.onPlayStateChange_();
|
||||
|
||||
+6
-1
@@ -66,7 +66,8 @@ shaka.extern.UIVolumeBarColors;
|
||||
* seekBarColors: shaka.extern.UISeekBarColors,
|
||||
* volumeBarColors: shaka.extern.UIVolumeBarColors,
|
||||
* trackLabelFormat: shaka.ui.TrackLabelFormat,
|
||||
* fadeDelay: number
|
||||
* fadeDelay: number,
|
||||
* doubleClickForFullscreen: boolean
|
||||
* }}
|
||||
*
|
||||
* @property {!Array.<string>} controlPanelElements
|
||||
@@ -119,6 +120,10 @@ shaka.extern.UIVolumeBarColors;
|
||||
* interacting with them. We recommend setting this to 3 on your cast
|
||||
* receiver UI.
|
||||
* Defaults to 0.
|
||||
* @property {boolean} doubleClickForFullscreen
|
||||
* Whether or not double-clicking on the UI should cause it to enter
|
||||
* fullscreen.
|
||||
* Defaults to true.
|
||||
*/
|
||||
shaka.extern.UIConfiguration;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user