diff --git a/src/js/player.js b/src/js/player.js index 84fe589ca..f2c6f8beb 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -3605,7 +3605,7 @@ class Player extends Component { resetProgressBar_() { this.currentTime(0); - const { durationDisplay, remainingTimeDisplay } = this.controlBar; + const { durationDisplay, remainingTimeDisplay } = this.controlBar || {}; if (durationDisplay) { durationDisplay.updateContent(); diff --git a/test/unit/player.test.js b/test/unit/player.test.js index 275c61fb3..0f081cb25 100644 --- a/test/unit/player.test.js +++ b/test/unit/player.test.js @@ -2066,6 +2066,24 @@ QUnit.test('player#reset removes remote text tracks', function(assert) { log.warn.restore(); }); +QUnit.test('player#reset progress bar', function(assert) { + + let error; + + const player = TestHelpers.makePlayer(); + + player.removeChild('controlBar'); + player.controlBar = null; + + try { + player.resetProgressBar_(); + } catch (e) { + error = e; + } + + assert.notOk(error, 'Function did not throw an error on resetProgressBar'); +}); + QUnit.test('Remove waiting class after tech waiting when timeupdate shows a time change', function(assert) { const player = TestHelpers.makePlayer();