-
Notifications
You must be signed in to change notification settings - Fork 286
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
videojs-ima is not destroyed when disposing video-js player #1106
Comments
I created a sandbox that resembles a simplified version of our videojs integration. I can reproduce the same behavior as described above in this sandbox: Buggy Videojs implementation
I hope this helps understand my problem. |
Hello @fleischsalod , I would recommend that when you destroy the player you also call During this process you may also need to call AdsLoader.destory() and AdsManager.destroy() if your app/site recreates another IMA SDK instance. These IMA class instances can be referenced using the plugin ad events (link). Please let me know if that solves your issue, or if you have any additional questions. Thank you, |
Hello @Kiro705, thank you for your reply! I tried out your ideas and destroyed the adDisplayContainer in my unmount function like that:
Still the video ad player instance seemed not to be destroyed. I could still resume the video by either using the play button on my keyboard or the Media-Notification in my Toolbar.
All the code to destroy these instances is called, but still i can resume the ad in the background. I found out, that actually my codesandbox-code loaded the ima3-sdk twice. I fixed that, but that was not the reason for my problem. Im pretty confident now, that my code does not create multiple instances of the ima-sdk. You can also see the concrete Code in this codesandbox, i updated it with the mentioned changes. Did i do anything wrong? |
Hi @fleischsalod, |
Hi @monta8, |
Is there any recommended way to destroy the videojs-ima instance, when disposing the video-js player?
I'm using React (v17) and dispose the video-js player as soon my React Functional-Component unmounts:
This is the exact same way as recommended in the video-js documentation and it works as expected. When unmounting the component, the videoJs-player disposes.
When i unmount the component while an ad is playing, then i can still resume the ad via the notification that is shown from the browser (Chrome 114 on MacOS Ventura 13.4):
Please note, that i currently do not use the Media Session API to update the notification content, that is why the title shown in the notification is still the title of my video although an ad is playing. I tried it with both an sample adTag as well as our real-world adTag that is used in our productive application.
This only happens, when unmounting while an ad is playing. If i unmount while my video is playing, then the notification is no longer shown. I'm assuming, that the IMA adsManager-instance is not properly destroyed when unmounting the page. Unfortunately i cannot find the right way to destroy it. I already tried this:
player.ima.getAdsManager().destroy()
Any hint is highly appreciated. I can also give more informations on how i initialize the video-js player and the ima-sdk, if necessary.
The text was updated successfully, but these errors were encountered: