Skip to content

Commit 2693bc7

Browse files
authored
fix(UI): Fix visibility events while casting (#8574)
1 parent 5ec05ca commit 2693bc7

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

ui/controls.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
142142
this.hideSettingsMenusTimer_.tickAfter(
143143
/* seconds= */ this.config_.closeMenusDelay);
144144

145-
this.dispatchEvent(new shaka.util.FakeEvent('hidingui'));
145+
this.dispatchVisibilityEvent_();
146146
});
147147

148148
/**
@@ -1591,7 +1591,7 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
15911591
this.updateTimeAndSeekRange_();
15921592
this.computeOpacity();
15931593

1594-
this.dispatchEvent(new shaka.util.FakeEvent('showingui'));
1594+
this.dispatchVisibilityEvent_();
15951595
}
15961596

15971597
// Hide the cursor when the mouse stops moving.
@@ -1740,6 +1740,7 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
17401740
} else {
17411741
this.controlsContainer_.removeAttribute('casting');
17421742
}
1743+
this.dispatchVisibilityEvent_();
17431744
}
17441745

17451746
/** @private */
@@ -1885,6 +1886,17 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
18851886
this.controlsContainer_.getAttribute('casting') != null;
18861887
}
18871888

1889+
/**
1890+
* @private
1891+
*/
1892+
dispatchVisibilityEvent_() {
1893+
if (this.isOpaque()) {
1894+
this.dispatchEvent(new shaka.util.FakeEvent('showingui'));
1895+
} else {
1896+
this.dispatchEvent(new shaka.util.FakeEvent('hidingui'));
1897+
}
1898+
}
1899+
18881900
/**
18891901
* Update the video's current time based on the keyboard operations.
18901902
*

0 commit comments

Comments
 (0)