1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-17 10:46:00 +02:00

@Naouak updated time display to not change if values do not change. closes #3101

This commit is contained in:
Quentin Burny 2016-02-19 12:04:06 -05:00 committed by Gary Katsevman
parent dd1f2b5c25
commit 0490728321
4 changed files with 11 additions and 3 deletions

View File

@ -5,6 +5,7 @@ CHANGELOG
* @gkatsev added issue and PR templates for github ([view](https://github.com/videojs/video.js/pull/3117))
* @Nipoto added fa.json (farsi/persian lang file) ([view](https://github.com/videojs/video.js/pull/3116))
* @forbesjo updated travis to use latest firefox ([view](https://github.com/videojs/video.js/pull/3112))
* @Naouak updated time display to not change if values do not change ([view](https://github.com/videojs/video.js/pull/3101))
--------------------

View File

@ -55,7 +55,10 @@ class CurrentTimeDisplay extends Component {
let time = (this.player_.scrubbing()) ? this.player_.getCache().currentTime : this.player_.currentTime();
let localizedText = this.localize('Current Time');
let formattedTime = formatTime(time, this.player_.duration());
this.contentEl_.innerHTML = `<span class="vjs-control-text">${localizedText}</span> ${formattedTime}`;
if (formattedTime !== this.formattedTime_) {
this.formattedTime_ = formattedTime;
this.contentEl_.innerHTML = `<span class="vjs-control-text">${localizedText}</span> ${formattedTime}`;
}
}
}

View File

@ -58,7 +58,8 @@ class DurationDisplay extends Component {
*/
updateContent() {
let duration = this.player_.duration();
if (duration) {
if (duration && this.duration_ !== duration) {
this.duration_ = duration;
let localizedText = this.localize('Duration Time');
let formattedTime = formatTime(duration);
this.contentEl_.innerHTML = `<span class="vjs-control-text">${localizedText}</span> ${formattedTime}`; // label the duration time for screen reader users

View File

@ -54,7 +54,10 @@ class RemainingTimeDisplay extends Component {
if (this.player_.duration()) {
const localizedText = this.localize('Remaining Time');
const formattedTime = formatTime(this.player_.remainingTime());
this.contentEl_.innerHTML = `<span class="vjs-control-text">${localizedText}</span> -${formattedTime}`;
if (formattedTime !== this.formattedTime_) {
this.formattedTime_ = formattedTime;
this.contentEl_.innerHTML = `<span class="vjs-control-text">${localizedText}</span> -${formattedTime}`;
}
}
// Allows for smooth scrubbing, when player can't keep up.