mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-06 18:06:35 +00:00
fix: add null checks for media controller
This commit is contained in:
@@ -148,7 +148,9 @@ class ZenMediaController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showMediaControls() {
|
showMediaControls() {
|
||||||
if (this._currentMediaController?.isBeingUsedInPIPModeOrFullscreen) return this.hideMediaControls();
|
if (!this._currentMediaController) return;
|
||||||
|
|
||||||
|
if (this._currentMediaController.isBeingUsedInPIPModeOrFullscreen) return this.hideMediaControls();
|
||||||
if (!this.mediaControlBar.hasAttribute('hidden')) return;
|
if (!this.mediaControlBar.hasAttribute('hidden')) return;
|
||||||
|
|
||||||
this.updatePipButton();
|
this.updatePipButton();
|
||||||
@@ -485,6 +487,8 @@ class ZenMediaController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updatePipButton() {
|
updatePipButton() {
|
||||||
|
if (!this._currentBrowser) return;
|
||||||
|
|
||||||
const isPipEligible = this.pipEligibilityMap.get(this._currentBrowser.browserId);
|
const isPipEligible = this.pipEligibilityMap.get(this._currentBrowser.browserId);
|
||||||
if (isPipEligible) this.mediaControlBar.setAttribute('can-pip', '');
|
if (isPipEligible) this.mediaControlBar.setAttribute('can-pip', '');
|
||||||
else this.mediaControlBar.removeAttribute('can-pip');
|
else this.mediaControlBar.removeAttribute('can-pip');
|
||||||
|
Reference in New Issue
Block a user