我用的是HTML5视频播放器VideoJS
默认情况下,它显示剩余时间(倒计时),而不是正常的当前时间(如youtube)
有什么办法可以“修复”它吗?您可以在their official website上看到一个现场示例
发布于 2017-06-04 10:30:04
为搜索解决方案的其他人提供...
所有定时器都存在于播放器上,但默认情况下,current-time
、time-divider
和duration
信息都隐藏在 display: none;
中。
所以我们唯一要做的就是隐藏remaining-time
和 time-control
,其中包括current-time
、time-divider
和duration
。
CSS代码中的解决方案应该与您的播放器一起使用:
.video-js .vjs-time-control {
display: block;
}
.video-js .vjs-remaining-time {
display: none;
}
文档没有解释这一点,或者更准确地说,当它解释如何使用CSS自定义播放器时,它没有解释这一点。
快速html代码片段:
<style type="text/css">
.video-js .vjs-time-control{display:block;}
.video-js .vjs-remaining-time{display: none;}
</style>
发布于 2017-10-16 15:55:16
最简单的方法是更改默认ControlBar.prototype.options
ControlBar.prototype.options_ = {
children: ['playToggle', 'volumePanel', 'currentTimeDisplay', 'timeDivider', 'durationDisplay', 'progressControl', 'liveDisplay', 'remainingTimeDisplay', 'customControlSpacer', 'playbackRateMenuButton', 'chaptersButton', 'descriptionsButton', 'subsCapsButton', 'audioTrackButton', 'fullscreenToggle']
};
更改为
ControlBar.prototype.options_ = {
loadEvent: 'play',
children: ['playToggle', 'volumeMenuButton', 'currentTimeDisplay', 'progressControl', 'liveDisplay', 'durationDisplay', 'customControlSpacer', 'playbackRateMenuButton', 'chaptersButton', 'subtitlesButton', 'captionsButton', 'fullscreenToggle']
};
最终显示时间控件
<style type="text/css">
.video-js .vjs-time-control{display:block;}
</style>
https://stackoverflow.com/questions/15324061
复制相似问题