如何解决使用 videojs-contrib-ads 与 react 和 typescript
谁能提供一个使用videojs-vast-vpaid with 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
});
});
我尝试将此代码添加到我的类组件中,但效果不佳,因为 this 将引用类组件上下文。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。