Usage of videojs-contrib-ads with react and typescript

560 views Asked by At

Can anyone please provide a detailed example of using videojs-vast-vpaid with react + typescript as a plugin of videojs. I tried following approach (Source: https://www.npmjs.com/package/videojs-vast-vpaid)

videojs.plugin('ads-setup', function (opts) {
    var player = this;
    var adsCancelTimeout = 3000;
 
    var vastAd = player.vastClient({
      //Media tag URL
      adTag: "http://pubads.g.doubleclick.net/gampad/ads?env=....",
      playAdAlways: true,
      //Note: As requested we set the preroll timeout at the same place than the adsCancelTimeout
      adCancelTimeout: adsCancelTimeout,
      adsEnabled: !!options.adsEnabled
    });
});

I tried adding this code to my class component but it didn't go well as this will refer to the class component context.

0

There are 0 answers