【发布时间】:2018-04-03 10:55:23
【问题描述】:
我正在使用允许我在 video-js 中显示广告的插件。
https://github.com/dirkjanm/videojs-preroll/blob/master/lib/videojs.ads.js
这在第 5 版之前运行良好,但现在我想迁移到第 6 版,这个插件不再有效,日志向我抛出以下错误:
TypeError: videojs.getComponent(...) is undefined videojs.ads.js:386
似乎一切都在插件的这一部分(第 386 行):
(function() {
var
videoEvents = videojs.getComponent('Html5').Events,
i,
returnTrue = function() { return true; },
triggerEvent = function(type, event) {
// pretend we called stopImmediatePropagation because we want the native
// element events to continue propagating
event.isImmediatePropagationStopped = returnTrue;
event.cancelBubble = true;
event.isPropagationStopped = returnTrue;
player.trigger({
type: type + event.type,
state: player.ads.state,
originalEvent: event
});
},
该插件前段时间没有更新,所以我也给了一些关于如何注册插件的警告,但是我可以解决它,我对javascript不太了解,所以我不知道如何解决那个。
【问题讨论】:
标签: javascript jquery plugins compatibility video.js