Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling destroy() on the UI doesn't remove the spinner or client side ad container elements #7311

Closed
absidue opened this issue Sep 13, 2024 · 0 comments · Fixed by #7320
Closed
Labels
component: UI The issue involves the Shaka Player UI priority: P2 Smaller impact or easy workaround type: bug Something isn't working correctly
Milestone

Comments

@absidue
Copy link

absidue commented Sep 13, 2024

Have you read the FAQ and checked for duplicate open issues?
Yes

If the problem is related to FairPlay, have you read the tutorial?
Not applicable

What version of Shaka Player are you using?
4.11.2

Can you reproduce the issue with our latest release version?
Yes

Can you reproduce the issue with the latest code from main?
Yes

Are you using the demo app or your own custom app?
Both

If custom app, can you reproduce the issue using our demo app?
Yes

What browser and OS are you using?
Firefox on Windows 10

For embedded devices (smart TVs, etc.), what model and firmware version are you using?
Not applicable

What are the manifest and license server URIs?
Not applicable

What configuration are you using? What is the output of player.getConfiguration()?
Default

What did you do?
Called destroy() on shaka.ui.Overlay.

What did you expect to happen?
Expected the shaka-spinner-container and shaka-client-side-ad-container elements to be removed from the DOM.

What actually happened?
The shaka-spinner-container and shaka-client-side-ad-container elements still exist in the DOM.

Are you planning send a PR to fix it?
No, because of the CLA, but here is a diff that should fix it:

--- a/ui/controls.js
+++ b/ui/controls.js
@@ -259,6 +259,16 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
       this.controlsContainer_ = null;
     }
 
+    if (this.spinnerContainer_) {
+      this.videoContainer_.removeChild(this.spinnerContainer_);
+      this.spinnerContainer_ = null;
+    }
+
+    if (this.clientAdContainer_) {
+      this.videoContainer_.removeChild(this.clientAdContainer_);
+      this.clientAdContainer_ = null;
+    }
+
     if (this.castProxy_) {
       await this.castProxy_.destroy();
       this.castProxy_ = null;
@@ -525,6 +535,8 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
    * @export
    */
   getClientSideAdContainer() {
+    goog.asserts.assert(
+        this.clientAdContainer_, 'No client ad container after destruction!');
     return this.clientAdContainer_;
   }
 
@@ -983,7 +995,7 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
 
   /** @private */
   addBufferingSpinner_() {
-    /** @private {!HTMLElement} */
+    /** @private {HTMLElement} */
     this.spinnerContainer_ = shaka.util.Dom.createHTMLElement('div');
     this.spinnerContainer_.classList.add('shaka-spinner-container');
     this.videoContainer_.appendChild(this.spinnerContainer_);
@@ -1140,7 +1152,7 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
    * @private
    */
   addClientAdContainer_() {
-    /** @private {!HTMLElement} */
+    /** @private {HTMLElement} */
     this.clientAdContainer_ = shaka.util.Dom.createHTMLElement('div');
     this.clientAdContainer_.classList.add('shaka-client-side-ad-container');
     shaka.ui.Utils.setDisplay(this.clientAdContainer_, false);
@absidue absidue added the type: bug Something isn't working correctly label Sep 13, 2024
@shaka-bot shaka-bot added this to the v4.12 milestone Sep 13, 2024
@avelad avelad added component: UI The issue involves the Shaka Player UI priority: P2 Smaller impact or easy workaround labels Sep 16, 2024
avelad added a commit that referenced this issue Sep 16, 2024
avelad added a commit that referenced this issue Sep 18, 2024
avelad added a commit that referenced this issue Sep 18, 2024
joeyparrish pushed a commit that referenced this issue Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: UI The issue involves the Shaka Player UI priority: P2 Smaller impact or easy workaround type: bug Something isn't working correctly
3 participants