Skip to content

videojs-ima is not destroyed when disposing video-js player #1106

@fleischsalod

Description

@fleischsalod

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:

useEffect(() => {
    const player = playerRef.current;

    return () => {
      if (player && !player.isDisposed()) {
        player.dispose();
        playerRef.current = null;
      }
    };
}, [playerRef]);

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):
Bildschirmfoto 2023-06-14 um 16 04 22
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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions