Skip to content

Commit

Permalink
Allow for setting a maxWidth onto the container instead of a width. W…
Browse files Browse the repository at this point in the history
…e needed this to make it work with the layout system in RW
  • Loading branch information
nholtman committed Sep 24, 2024
1 parent e1e3765 commit 6dd9b9f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package.describe({
name: 'johndyer:mediaelement',
summary: '*Official* MediaElement.js: <video> and <audio> made easy. One file. Any browser. Same UI.',
version: '7.0.5',
version: '7.0.6',
git: 'https://github.com/mediaelement/mediaelement'
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@A-VISION-BV/mediaelement",
"license": "MIT",
"version": "7.0.5",
"version": "7.0.6",
"main": "full.js",
"repository": {
"type": "git",
Expand Down
13 changes: 10 additions & 3 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export const config = {
defaultSeekForwardInterval: (media) => media.getDuration() * 0.05,
// Set dimensions via JS instead of CSS
setDimensions: true,
// sets maxWidth instead of width for just the container element.
useMaxWidthForContainer: false,
// Width of audio player
audioWidth: -1,
// Height of audio player
Expand Down Expand Up @@ -1283,10 +1285,15 @@ class MediaElementPlayer {

width = isString(width) && width.indexOf('%') > -1 ? width : `${parseFloat(width)}px`;
height = isString(height) && height.indexOf('%') > -1 ? height : `${parseFloat(height)}px`;

if (t.options.useMaxWidthForContainer) {
t.getElement(t.container).style.maxWidth = width;
} else {
t.getElement(t.container).style.width = width;
}
t.getElement(t.container).style.height = height;

t.getElement(t.container).style.width = width;
t.getElement(t.container).style.height = height;


const layers = t.getElement(t.layers).children;
for (let i = 0, total = layers.length; i < total; i++) {
layers[i].style.width = width;
Expand Down

0 comments on commit 6dd9b9f

Please sign in to comment.