Javascript .关闭“timeupdate”上的进度更新,稍后使用.on继续

Javascript .关闭“timeupdate”上的进度更新,稍后使用.on继续,javascript,event-handling,video.js,Javascript,Event Handling,Video.js,使用video.js媒体播放器,我想继续播放媒体,但暂时暂停更新进度指示器进度栏和当前时间指示器。过了一会儿,我想恢复进度指标 这些进度指示器侦听“timeupdate”事件。我不知道如何关闭特定的函数。带video.off'timeupdate';我删除“timeupdate”事件的所有处理程序。但我不想删除所有“timeupdate”处理程序,只删除两个特定的处理程序: .controlBar.currentTimeDisplay.updateContent() .controlBar.pr

使用video.js媒体播放器,我想继续播放媒体,但暂时暂停更新进度指示器进度栏和当前时间指示器。过了一会儿,我想恢复进度指标

这些进度指示器侦听“timeupdate”事件。我不知道如何关闭特定的函数。带video.off'timeupdate';我删除“timeupdate”事件的所有处理程序。但我不想删除所有“timeupdate”处理程序,只删除两个特定的处理程序:

.controlBar.currentTimeDisplay.updateContent()
.controlBar.progressControl.seekBar.update()
我忘记了我尝试删除特定处理程序的所有不同方法

以下操作不起作用:

video.player_.controlBar.currentTimeDisplay.off(video.player_, 'timeupdate', this.updateContent)
Uncaught TypeError: Cannot read property 'guid' of undefined
这不会引发错误,但也不会执行任何操作:

video.player_.controlBar.currentTimeDisplay.off(video.player_, 'timeupdate', video.player_.controlBar.currentTimeDisplay.updateContent)
使用此功能,我可以稍后恢复进度显示:

video.on('timeupdate', function(){
                this.controlBar.currentTimeDisplay.updateContent();
                this.controlBar.remainingTimeDisplay.updateContent();
                this.controlBar.progressControl.seekBar.updateARIAAttributes();
                this.controlBar.progressControl.seekBar.update();
});
但我认为这也不对


我制作了一个JSFIDLE来展示我正在尝试做的事情:进度更新被暂停,但所有其他侦听“timeupdate”的事件也被删除。

通过向对象添加用于删除和添加其事件侦听器的函数,使其工作正常

var video = videojs('example_video_1');

function startStopUpdate() {

    vjs.CurrentTimeDisplay.prototype.stopUpdateContent = function(){
        this.off(this.player_, 'timeupdate', this.updateContent);
    }

    vjs.CurrentTimeDisplay.prototype.startUpdateContent = function(){
        this.on(this.player_, 'timeupdate', this.updateContent);
    }

    vjs.SeekBar.prototype.stopUpdate = function(){
        this.off(this.player_, 'timeupdate', this.update);
    }

    vjs.SeekBar.prototype.startUpdate = function(){
        this.on(this.player_, 'timeupdate', this.update);
    }   
}

videojs.plugin('startStopUpdate', startStopUpdate);
video.startStopUpdate();

function stopUpdate(){
    console.log('stopUpdate');   
    video.controlBar.currentTimeDisplay.stopUpdateContent();
    video.controlBar.progressControl.seekBar.stopUpdate();
}

function startUpdate(){
    console.log('startUpdate');
    video.controlBar.currentTimeDisplay.startUpdateContent();
    video.controlBar.progressControl.seekBar.startUpdate();
};

setTimeout(stopUpdate, 2000);
setTimeout(startUpdate, 10000);