Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/js/control-bar/time-controls/current-time-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CurrentTimeDisplay extends TimeDisplay {

if (this.player_.ended()) {
time = this.player_.duration();
} else if (event && event.target && typeof event.target.pendingSeekTime === 'function') {
} else if (event && event.target && typeof event.target.pendingSeekTime === 'function' && event.target.pendingSeekTime() !== null) {
time = event.target.pendingSeekTime();
} else {
time = (this.player_.scrubbing()) ? this.player_.getCache().currentTime : this.player_.currentTime();
Expand Down
22 changes: 22 additions & 0 deletions test/unit/controls.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,28 @@ QUnit.test('Remaing time negative sign can be optional', function(assert) {
player.dispose();
});

QUnit.test('Current time display shouldn\'t flash zero on seek', function(assert) {
const player = TestHelpers.makePlayer({ techOrder: ['html5'] });
const currentTimeDisplay = player.controlBar.currentTimeDisplay;
const spy = sinon.spy(currentTimeDisplay, 'updateTextNode_');

player.ended = () => false;
player.currentTime = () => 10;

currentTimeDisplay.updateContent({
target: {
pendingSeekTime: () => null
}
});

this.clock.tick(1);

assert.ok(spy.calledWith(10), 'control was updated with currentTime');
assert.notOk(spy.calledWith(null), 'control was not updated with null');
assert.notStrictEqual(currentTimeDisplay.formattedTime_, '0:00', 'display text not set to 0:00');

});

QUnit.module('SmartTV UI Updates (Progress Bar & Time Display)', function(hooks) {
let player;
let seekBar;
Expand Down