1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-12 11:15:04 +02:00

fix: reset() should null check the controlBar (#7692)

Fixes #7689

Co-authored-by: alex <try2betheb3st@gmail.com>
Co-authored-by: Pat O'Neill <pgoneill@gmail.com>
This commit is contained in:
try2beth3b3st 2022-05-04 18:43:52 +03:00 committed by GitHub
parent 054329899b
commit 7e2b9ec411
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -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();

View File

@ -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();