From 8aacdcf76ca80f5927205995584fb9e8d1cf774d Mon Sep 17 00:00:00 2001 From: Theodore Abshire Date: Wed, 5 Jan 2022 02:08:57 -0800 Subject: [PATCH] feat(UI): Adds singleClickForPlayAndPause config Closes #3821 Change-Id: I94ba5a5e69e9934aff7b50d73a819b463bf9e8aa --- ui/controls.js | 2 +- ui/externs/ui.js | 4 ++++ ui/ui.js | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/controls.js b/ui/controls.js index a3bd3bcd8e..c5d454f10e 100644 --- a/ui/controls.js +++ b/ui/controls.js @@ -1178,7 +1178,7 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget { if (this.anySettingsMenusAreOpen()) { this.hideSettingsMenusTimer_.tickNow(); - } else { + } else if (this.config_.singleClickForPlayAndPause) { this.onPlayPauseClick_(); } } diff --git a/ui/externs/ui.js b/ui/externs/ui.js index 6425169d7a..5e8dd8e65d 100644 --- a/ui/externs/ui.js +++ b/ui/externs/ui.js @@ -79,6 +79,7 @@ shaka.extern.UIVolumeBarColors; * trackLabelFormat: shaka.ui.Overlay.TrackLabelFormat, * fadeDelay: number, * doubleClickForFullscreen: boolean, + * singleClickForPlayAndPause: boolean, * enableKeyboardPlaybackControls: boolean, * enableFullscreenOnRotation: boolean, * forceLandscapeOnFullscreen: boolean, @@ -154,6 +155,9 @@ shaka.extern.UIVolumeBarColors; * Whether or not double-clicking on the UI should cause it to enter * fullscreen. * Defaults to true. + * @property {boolean} singleClickForPlayAndPause + * Whether or not clicking on the video should cause it to play or pause. + * Defaults to true. * @property {boolean} enableKeyboardPlaybackControls * Whether or not playback controls via keyboard is enabled, such as seek * forward, seek backward, jump to the beginning/end of the video. diff --git a/ui/ui.js b/ui/ui.js index dd24c2b787..fcf5a5976f 100644 --- a/ui/ui.js +++ b/ui/ui.js @@ -233,6 +233,7 @@ shaka.ui.Overlay = class { trackLabelFormat: shaka.ui.Overlay.TrackLabelFormat.LANGUAGE, fadeDelay: 0, doubleClickForFullscreen: true, + singleClickForPlayAndPause: true, enableKeyboardPlaybackControls: true, enableFullscreenOnRotation: true, forceLandscapeOnFullscreen: true,