我试图以一种使用自定义功能的方式覆盖VideoJs的一个组件:
video.js中的部分代码:
var PlayProgressBar = function (_Component) {
inherits(PlayProgressBar, _Component);
...
PlayProgressBar.prototype.update = function update(seekBarRect, seekBarPoint) {
...
this.rafId_ = this.requestAnimationFrame(function () {
var time = _this2.player_.scrubbing() ? _this2.player_.getCache().currentTime : _this2.player_.currentTime();
var content = formatTime(time, _this2.player_.duration());
var timeTooltip = _this2.getChild('timeTooltip');
if (timeTooltip) {
timeTooltip.update(seekBarRect, seekBarPoint, content);
}
});
};
return PlayProgressBar;
}(Component);
兴趣点:
this.rafId_ = this.requestAnimationFrame(function () {
var time = _this2.player_.scrubbing() ? _this2.player_.getCache().currentTime : _this2.player_.currentTime();
var content = formatTime(time, _this2.player_.duration());
var timeTooltip = _this2.getChild('timeTooltip');
if (timeTooltip) {
timeTooltip.update(seekBarRect, seekBarPoint, content);
}
});
兴趣点变化(CUSTOMFUNCTION):
this.rafId_ = this.requestAnimationFrame(function () {
var time = _this2.player_.scrubbing() ? _this2.player_.getCache().currentTime : _this2.player_.currentTime();
var content = CUSTOMFUNCTION(time, _this2.player_.duration());
var timeTooltip = _this2.getChild('timeTooltip');
if (timeTooltip) {
timeTooltip.update(seekBarRect, seekBarPoint, content);
}
});
我无法覆盖原始的video.js文件,所以我试图用
覆盖它videojs.getComponent("PlayProgressBar").f...
但我没有成功。我该怎么办?