googleads / videojs-ima

IMA SDK Plugin for Video.js
Apache License 2.0
450 stars 284 forks source link

Memory leakage issue while playing ad after each video in a playlist. #805

Closed gizmeondev closed 4 years ago

gizmeondev commented 5 years ago

I am using videojs for playing a playlist with remote urls. My aim is to show an ad after each video is played and it worked after requesting ads in corresponding player.ready and player.on("ended") function. The memory used increases while playing an ad and then decreasing when completed, which is fine. But the lowering does not always reaches from where it starts. For example, assume the player is playing a video at 255 MB, an ad is requested, which now turns to 310 MB. After the ad is completed, the memory will now be 260 MB, which means there is some leakage issue. Due to this, after a very long time, it consumes almost full memory which leads to device crash. So any ideas on how to fix this?

arnaudcasame commented 5 years ago

Hi,

It seems that you're not destroying your adsManager after each ad. Please confirm if you are manually requesting an ad after each video content.

gizmeondev commented 5 years ago

Yes, I am manually requesting ad after each video ended. How can we destroy the adsManager after ad is played?

arnaudcasame commented 5 years ago

Hi,

To destroy the IMA SDK's AdsManager instance, you have to register to the ALL_ADS_COMPLETED event and then call the this.player.ima.getAdsManager().destroy() method whenever this event is fired (all the ads are done playing). To get an idea of how to register to the ALL_ADS_COMPLETED event, you can take a look at the Advanced sample implementation.

arnaudcasame commented 4 years ago

Hi,

I’m closing this issue because it has been inactive for more than a month. Please reopen if you still encounter this issue with the latest stable version

Thank you!