diff --git a/demo/cast_receiver/receiver_app.js b/demo/cast_receiver/receiver_app.js index cc4b7efe2d..8422b85f77 100644 --- a/demo/cast_receiver/receiver_app.js +++ b/demo/cast_receiver/receiver_app.js @@ -50,6 +50,7 @@ class ShakaReceiverApp { // Make sure we don't show extra UI elements we don't need on the TV. ui.configure({ + noFade: true, controlPanelElements: [ 'play_pause', 'time_and_duration', diff --git a/ui/controls.js b/ui/controls.js index 5ae5272812..66e2f6d66d 100644 --- a/ui/controls.js +++ b/ui/controls.js @@ -363,6 +363,11 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget { // Create the new layout this.createDOM_(); + // If the controls are supposed to not fade, then they should be shown here. + if (config.noFade) { + this.setControlsOpacity_(shaka.ui.Enums.Opacity.OPAQUE); + } + // Init the play state this.onPlayStateChange_(); @@ -1046,7 +1051,7 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget { // Keep showing the controls if ad or video is paused or one of // the control menus is hovered. - if (adIsPaused || + if (adIsPaused || this.config_.noFade || (!this.ad_ && videoIsPaused) || this.overrideCssShowControls_) { this.setControlsOpacity_(shaka.ui.Enums.Opacity.OPAQUE); } else { diff --git a/ui/externs/ui.js b/ui/externs/ui.js index cab871bdf0..73a8b8b621 100644 --- a/ui/externs/ui.js +++ b/ui/externs/ui.js @@ -60,7 +60,8 @@ shaka.extern.UIVolumeBarColors; * clearBufferOnQualityChange: boolean, * seekBarColors: shaka.extern.UISeekBarColors, * volumeBarColors: shaka.extern.UIVolumeBarColors, - * trackLabelFormat: shaka.ui.TrackLabelFormat + * trackLabelFormat: shaka.ui.TrackLabelFormat, + * noFade: boolean * }} * * @property {!Array.} controlPanelElements @@ -97,6 +98,8 @@ shaka.extern.UIVolumeBarColors; * ROLE means that only the role of the item is shown. * LANGUAGE_ROLE means both are shown, or just language if there is no role. * Defaults to LANGUAGE. + * @property {boolean} noFade + * If set to true, the UI will not fade, even if the user is not mousing over. */ shaka.extern.UIConfiguration; diff --git a/ui/ui.js b/ui/ui.js index c427464fbb..138557d982 100644 --- a/ui/ui.js +++ b/ui/ui.js @@ -210,6 +210,7 @@ shaka.ui.Overlay = class { level: 'rgb(255, 255, 255)', }, trackLabelFormat: shaka.ui.TrackLabelFormat.LANGUAGE, + noFade: false, }; }