Skip to content

Commit

Permalink
fix(player): Changed target to execute keydown event to main wrapper …
Browse files Browse the repository at this point in the history
…to use keyboard successfully
  • Loading branch information
rafa8626 committed Aug 25, 2018
1 parent 1d8714e commit b2b2893
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -6,12 +6,12 @@

This awesome player mimics the HTML5 video/audio methods/events/properties, and integrates the most popular libraries to play different types of native media, such as MP4/MP3, HLS and M(PEG)-DASH.

It also has the ability to play VAST and VPAID Ads in an effortless way!
It also has the ability to play VMAP, VAST and VPAID Ads in an effortless way!

## Why OpenPlayer?

* **Less than `20KB`** when gzipped.
* **Monetize video and audio content** with video advertising using [Interactive Media Ads SDK](https://developers.google.com/interactive-media-ads/) (IMA SDK) library.
* **Monetize video and audio content** with video advertising (VAST/VPAID/VMAP) using [Interactive Media Ads SDK](https://developers.google.com/interactive-media-ads/) (IMA SDK) library.
* **Simplified markup** and **highly customizable CSS** (even specific styling for high contrast mode). See https://developer.paciellogroup.com/blog/2010/01/high-contrast-proof-css-sprites/ for more details.
* IMA SDK, [hls.js](https://github.com/video-dev/hls.js/) and [dash.js](https://github.com/Dash-Industry-Forum/dash.js/) use **ever-green scripts** from their recommended CDN sources to always obtain the latest upgrades.
* **Smart `autoplay`** by detecting browser's capabilities.
Expand Down
7 changes: 4 additions & 3 deletions dist/openplayer.js
Expand Up @@ -1773,6 +1773,9 @@ var Player = function () {
_this3.playBtn.setAttribute('aria-hidden', el instanceof media_1.default ? 'false' : 'true');
};
}
Object.keys(this.events).forEach(function (event) {
_this3.element.addEventListener(event, _this3.events[event]);
});
this.events.keydown = function (e) {
var el = _this3.activeElement();
var isAd = el instanceof ads_1.default;
Expand Down Expand Up @@ -1826,9 +1829,7 @@ var Player = function () {
return true;
}
};
Object.keys(this.events).forEach(function (event) {
_this3.element.addEventListener(event, _this3.events[event]);
});
this.getContainer().addEventListener('keydown', this.events.keydown);
}
}, {
key: "_autoplay",
Expand Down
2 changes: 1 addition & 1 deletion dist/openplayer.min.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/js/player.ts
Expand Up @@ -657,6 +657,10 @@ class Player {
};
}

Object.keys(this.events).forEach(event => {
this.element.addEventListener(event, this.events[event]);
});

this.events.keydown = (e: any) => {
const el = this.activeElement();
const isAd = el instanceof Ads;
Expand Down Expand Up @@ -713,9 +717,7 @@ class Player {
}
};

Object.keys(this.events).forEach(event => {
this.element.addEventListener(event, this.events[event]);
});
this.getContainer().addEventListener('keydown', this.events.keydown);
}

/**
Expand Down

0 comments on commit b2b2893

Please sign in to comment.