Skip to content

Commit

Permalink
fix(player): Removed unnecessary event workflow and added loader stat…
Browse files Browse the repository at this point in the history
…e in `loadedmetadata` event
  • Loading branch information
rafa8626 committed Dec 3, 2018
1 parent 753ae76 commit 2f6c03c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
10 changes: 2 additions & 8 deletions dist/openplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,8 @@ var Player = function () {
this.events.loadedmetadata = function () {
var el = _this3.activeElement();

_this3.loader.setAttribute('aria-hidden', 'true');

if (el.paused) {
_this3.playBtn.classList.remove('op-player__play--paused');

Expand All @@ -1685,14 +1687,6 @@ var Player = function () {
_this3.loader.setAttribute('aria-hidden', 'false');
};

this.events.durationchange = function () {
var el = _this3.activeElement();

_this3.playBtn.setAttribute('aria-hidden', 'true');

_this3.loader.setAttribute('aria-hidden', el instanceof media_1.default || constants_1.IS_ANDROID || constants_1.IS_IOS ? 'false' : 'true');
};

this.events.canplay = function () {
_this3.playBtn.setAttribute('aria-hidden', 'true');

Expand Down
2 changes: 1 addition & 1 deletion dist/openplayer.min.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions src/js/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ class Player {
if (isVideo(this.element)) {
this.events.loadedmetadata = () => {
const el = this.activeElement();
this.loader.setAttribute('aria-hidden', 'true');
if (el.paused) {
this.playBtn.classList.remove('op-player__play--paused');
this.playBtn.setAttribute('aria-pressed', 'false');
Expand All @@ -717,11 +718,6 @@ class Player {
this.playBtn.setAttribute('aria-hidden', 'true');
this.loader.setAttribute('aria-hidden', 'false');
};
this.events.durationchange = () => {
const el = this.activeElement();
this.playBtn.setAttribute('aria-hidden', 'true');
this.loader.setAttribute('aria-hidden', el instanceof Media || IS_ANDROID || IS_IOS ? 'false' : 'true');
};
this.events.canplay = () => {
this.playBtn.setAttribute('aria-hidden', 'true');
this.loader.setAttribute('aria-hidden', 'true');
Expand Down

0 comments on commit 2f6c03c

Please sign in to comment.