Skip to content

Commit

Permalink
fix(player): reset CSS classes at player.reset
Browse files Browse the repository at this point in the history
Allows CSS classes to be reset when `player.reset` is called,
so that the player is close to its initial state.

- remove `vjs-playing`
- add `vjs-paused`
  • Loading branch information
amtins committed Nov 11, 2023
1 parent d535e16 commit c1e4790
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -3599,6 +3599,10 @@ class Player extends Component {
if (this.tech_) {
this.tech_.clearTracks('text');
}

this.removeClass('vjs-playing');
this.addClass('vjs-paused');

this.resetCache_();
this.poster('');
this.loadTech_(this.options_.techOrder[0], null);
Expand Down
4 changes: 4 additions & 0 deletions test/unit/player.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,8 @@ QUnit.test('player#reset loads the Html5 tech and then techCalls reset', functio
options_: {
techOrder: ['html5', 'youtube']
},
addClass() {},
removeClass() {},
resetCache_() {},
loadTech_(tech, source) {
loadedTech = tech;
Expand Down Expand Up @@ -1942,6 +1944,8 @@ QUnit.test('player#reset loads the first item in the techOrder and then techCall
options_: {
techOrder: ['youtube', 'html5']
},
addClass() {},
removeClass() {},
resetCache_() {},
loadTech_(tech, source) {
loadedTech = tech;
Expand Down

0 comments on commit c1e4790

Please sign in to comment.