fix: add null checks for media controller

This commit is contained in:
Slowlife01
2025-04-02 21:36:15 +07:00
parent 8f571d5800
commit bb9711639c

View File

@@ -148,7 +148,9 @@ class ZenMediaController {
}
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;
this.updatePipButton();
@@ -485,6 +487,8 @@ class ZenMediaController {
}
updatePipButton() {
if (!this._currentBrowser) return;
const isPipEligible = this.pipEligibilityMap.get(this._currentBrowser.browserId);
if (isPipEligible) this.mediaControlBar.setAttribute('can-pip', '');
else this.mediaControlBar.removeAttribute('can-pip');