我正在使用一个插件,它允许我在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,所以我不知道如何解决这个问题。
发布于 2017-10-23 07:34:08
好了,同志们,我一直在读videojs 6的手册,显然,要解决这个问题,只需更改一行:
videojs.getComponent -to- videojs.getTech我把它放在这里,以防有人遇到同样的问题。当然,我不是Javascript专家,所以老实说,我不知道如何解释这一点。
https://stackoverflow.com/questions/46880101
复制相似问题