diff options
Diffstat (limited to 'src/js/html5.js')
-rw-r--r-- | src/js/html5.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/js/html5.js b/src/js/html5.js index 3266a58e..b03e9c26 100644 --- a/src/js/html5.js +++ b/src/js/html5.js @@ -6,6 +6,7 @@ import support from './support'; import { removeElement } from './utils/elements'; import { triggerEvent } from './utils/events'; import is from './utils/is'; +import { setAspectRatio } from './utils/style'; const html5 = { getSources() { @@ -43,12 +44,17 @@ const html5 = { const player = this; + // Set aspect ratio if fixed + if (!is.empty(this.config.ratio)) { + setAspectRatio.call(player); + } + // Quality Object.defineProperty(player.media, 'quality', { get() { // Get sources const sources = html5.getSources.call(player); - const source = sources.find(source => source.getAttribute('src') === player.source); + const source = sources.find(s => s.getAttribute('src') === player.source); // Return size, if match is found return source && Number(source.getAttribute('size')); @@ -56,9 +62,8 @@ const html5 = { set(input) { // Get sources const sources = html5.getSources.call(player); - // Get first match for requested size - const source = sources.find(source => Number(source.getAttribute('size')) === input); + const source = sources.find(s => Number(s.getAttribute('size')) === input); // No matching source found if (!source) { |