gpt4 book ai didi

javascript - 在 video.js 中扩展进度控制,重复进度条

转载 作者:行者123 更新时间:2023-11-28 07:13:55 28 4
gpt4 key购买 nike

当我扩展 ProgressControl 对象时遇到问题,它也会克隆 slider ,因此当前有两个。我尝试通过扩展 ProgressControl 来解决这个问题是否错误,或者我应该以不同的方式创建元素?

this.player = videojs("id", videojsOptions);
var thePlayer = this.player;

videojs.TrimVideo = videojs.ProgressControl.extend({
init: function(player, options){
videojs.ProgressControl.call(this, player, options);
}
});

this.player.controlBar.progressControl.trimVideo = this.player.controlBar.progressControl.addChild(
new videojs.TrimVideo(thePlayer, {
el: videojs.Component.prototype.createEl(null, {
className: 'vjs-trim-start-button vjs-menu-button',
innerHTML: '<div style="">words and words</div>',
role: 'button'
})
})
);

Mini progress control under new element

Link to Progress Control documentation

Have created a jsfiddle that replicates the behaviour

最佳答案

初始化新的 progressControl 时它将子项合并在一起,你必须显式地将seekBar设置为false。所以你最终会得到类似的东西

this.player.controlBar.progressControl.trimVideo = this.player.controlBar.progressControl.addChild(
new videojs.TrimVideo(thePlayer, {
el: videojs.Component.prototype.createEl(null, {
className: 'vjs-trim-start-button vjs-menu-button',
innerHTML: '<div style="">words and words</div>',
role: 'button'
}),
seekBar: false, // either this
children: {seekBar: false} // or this
})
);

关于javascript - 在 video.js 中扩展进度控制,重复进度条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31040412/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com