谁能提供一个使用videojs-vast-vpaid 和 react + typescript作为 videojs 插件的详细示例。我尝试了以下方法(来源: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
});
});
我尝试将此代码添加到我的类组件中,但它并不顺利,因为这将引用类组件上下文。