Closed (fixed)
Project:
MediaElement
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 Nov 2011 at 23:03 UTC
Updated:
8 Nov 2019 at 14:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
pixelsweatshop commentedI have also been trying to hack around to get this to work with no such luck. It looks like mediaelement.js doesn't support % widths. Any thoughts on this mfer?
Comment #2
gmclelland commentedwould this work? http://fitvidsjs.com/
Comment #3
zengenuity commentedI just did a small hack to the code that works for me. Lines 113 - 120 of mediaelement.module, remove the cast to (int) on the settings variables.
This is allowing me to enter 100% on the settings form, and it's working for audio files. (I'm not doing video on this site, so can't check that right now.) The labeling on the Manage Display form is wrong (it says 100% px), but otherwise, this is working for me.
Comment #4
kenianbei commentedThis works with video as well. I set both width and height to 100% and got good results.
FYI, this was added the the mejs here: https://github.com/johndyer/mediaelement/issues/283.
Can we get this added in the next commit for dev? I've patched against 7.x-2.x (which I think is 1.2???).
Comment #5
pixelsweatshop commentedThe following patch utilizes the fixes proposed by zengenuity and also fixes some of the UI WTF for the field formater, so a user doesn't see
width: 90% pxand some help text that tells the user to enter a px or % along with their width/height values.Comment #6
pixelsweatshop commentedSorry, here's a better one
Comment #7
pixelsweatshop commentedDid some more testing and appears that Version MediaElement.js 2.2.2 (2011/10/07) only added support for
<del>`<video width="100%" height="100%"></video>`</del> `<video style="width:100%;height:100%"></video>The good news is that we can actually make the height maintain the aspect ratio though. Reworked the patch to specify 100% in UI for users.
We may need to add some validation to make sure a user doesn't add 80% or leave out specifying px or %, then wonder why it isn't working. Otherwise it works swimmingly.
Comment #8
eusonic commented#7 works for me.
From my perspective, responsiveness is the killer feature for MediaElement.js. I haven't seen another player that handles it as well. Can we get this committed?
Comment #9
jdanthinne commented#7 works for me too.
Please commit!
Comment #10
AndrzejG commentedI have opposite problem. I need width and height controlled but Media element screen always fills full width of DOM box (excl. padding) no matter how I configure it on File types or in Manage Fields Display of content types (I need video as separate fields).
How to overcome responsiveness?
Comment #11
AndrzejG commentedOK, I discovered that the newest js library provides responsive player. After switching to v. 2.9.0-2... all is OK.
Comment #12
uptil4music commented#7 works for me for audio, haven't tried video yet. Thanks.
Comment #13
jnorell commentedThat patch tested fine for me, too.
Comment #14
kingfisher64 commented#7 patch worked fine against latest dev version. 15th Jan 2012.
Not sure it's required though as the player appears to be already responsive given previous library comments.
Can this issue just be closed and marked as fixed?
Comment #15
kenianbei commented#7 worked for me as well... please commit!
Comment #16
lewisnymanJust applied this patch and it works great. It seems silly not supporting fluid video when this library is meant to work on all devices. Let's commit this patch.
Comment #17
dave reidDo we need to escape the width and height values before outputting them into JavaScript? I'm not sure these values can be trusted?
Comment #18
dave reidI think this should be attempted as well.
Comment #19
lewisnymanI think it makes sense to default to px if the user doesn't specify a unit. That way we won't break existing sites when they upgrade.
Comment #20
SamSteinig commentedJust applied it myself (#7). Works beautifully in my responsive panels layout. Commit!
Comment #21
SamSteinig commentedI had an existing site I applied the patch to, and this was just the behavior: it defaulted to px and kept the pixel dimensions I had previously supplied.
Comment #22
aaronchristian commentedPatch works as expected, however when viewing the media player within Opera & IE8 the video doesn't have a default size and shows up at a thumbnail size. Anyone experienced this issue?
Screenshot
Comment #23
krisrobinson commented#7 Patch worked as expected.
Comment #24
fatel commentedSince the relevant functions have been moved to mediaelement.field.inc, patch #7 won't work anymore - I've attached a new patchfile which will work for the current dev-version of mediaelement
Comment #25
dagomar commentedLatest patch works fine.
Comment #26
Max_Headroom commentedReviewed and tested. #24 works fine
Comment #27
Tommy Wu commentedtrying to apply the patch #24 with GnuWin32 uder the folder sites/all/modules/mediaelement but apparently it cannot find the file mediaelement.field.inc to patch. Can someone help me and tell me where is the mediaelement.field.inc located?
Comment #28
Tommy Wu commentedJust realized I didn't read carefully. I am having the wrong version of media element. Update to 7.1.x and the patch under #24 works right away. Thanks.
Comment #29
7huo commentedReviewed and tested. #24 works fine
mediaelementjs 2.15.1
Comment #30
Max_Headroom commentedSometimes I wonder why I bother
Comment #31
konrad_u commentedthanks for the patch fatel... glad looked through issue que
24# - ready to commit
Comment #32
izmeez commentedPatch in #24 applies to current dev release but having some difficulties with the configuration of YouTube videos. With width="100%" and height="auto" or blank results in narrow iframe all the time. The aspect ration of youtube video is correct and shows as thumbnail size when playing.
Any suggestions would be appreciated.
Comment #33
kingfisher64 commentedPatch on #24 to latest dev which patched correctly and works with an older library version however when using mediaelement.js 2.16.4 (latest) it didn't work. I believe it was 2.13.1 (2013/09/06) that did work.
Edit:
Will try the library version between the working and broken.
Can you please commit this Mr Maintainer? It's been quite a while since there's been a stable release.
Many thanks
Comment #34
izmeez commented@kingfisher64 Thanks for the feedback. Can't see being dependent on an older version of the library but it may help to resolve what is going on with this issue. Thanks.
Comment #35
izmeez commentedBased on comments #33 & #34 that this patch is not working with the latest release of the library mediaelement-2.16.4 I have changed the status to needs work.
[edit] Comment #29 indicates the problem comes after mediaelement-2.15.1 [/edit]
Comment #36
izmeez commentedI must beg for your forgiveness. I have dug into this deeper and think my interpretations in previous comments were wrong. This patch behaves the same with the most recent version of the library mediaelementjs-2.16.4
My problems seemed to be related to correctly configuring File types >> Manage file display.
It definitely needs caches to be flushed.
And it does not seem to work for youtube video but fitvids takes care of that.
Sorry for the noise.
I have reset the status to RTBC.
Comment #37
BDaggerhart commentedJust wanted to put in my thoughts on this. I applied the patch and it doesn't work for me. When I change the field display to use 100% width and use firebug to view the results, on the right side (the style window), it tells me the 100% is into effect, but in multiple locations on the left side (the html window), it appears as though 300px is hard-coded into multiple areas. Am I reading too much into this? Either way, it's not working or responsive for me. (image uploaded to show what I'm seeing)
Comment #38
nlambert commentedI haven't looked into this enough, but patch #24 doesn't seem to work on its own.
For this to work, I needed the following css.
So I'm changing to needs review, but feel to contest or explain how this should work.
Cheers
Comment #39
davidneedhamChanging back to "Needs work" until the broken issues are addressed in a patch. #37 sounds like it may need more significant changes than just CSS.
Comment #40
jmuzz commentedThe patch works for me. I'm not seeing height 100% in any of the problem examples provided. You have to make both the height and width 100% to make the video responsive. I know that's not logical but it doesn't seem to turn on responsive mode unless they both are. The style attribute in my related html does use hardcoded px values like in the above screenshot, but they are updated by javascript when I resize my browser.
I couldn't find this documented on the official page but the height 100% thing is documented in this blog article and you can see it present on the responsive demo on the mediaelement.js github.
Comment #41
dobrzyns commentedI can confirm that the patch works for the audio player with the latest mediaelement libarary version (2.20.0). I had to update the Mediaelement library for everything to work properly on the responsive audio player.
Comment #42
dovran commented#4 work for me, beatiful
Comment #43
pinueve commented#24 without #38 and in field display settings set heigth and width to 100% works perfect on a boostrap sub-theme
Comment #44
chris matthews commentedThe patch in #24 no longer applies to 7.x-1.x-dev so setting back to needs work for now.
Comment #45
bmunslow commentedPlease find attached new patch that applies to 7.x-1.x-dev and fixes issue with responsive elements.
Comment #46
vchen commentedI tried patch #45 and I got this response:
can't find file to patch at input line 5
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/mediaelement.field.inc b/mediaelement.field.inc
|index c8b20b26..c83ff75a 100644
|--- a/mediaelement.field.inc
|+++ b/mediaelement.field.inc
--------------------------
Indeed, I don't have mediaelement.field.inc. Which file is it supposed to patch?
Comment #47
bmunslow commentedHi @vchen
Make you sure you are patching the
devversion of the module:https://www.drupal.org/project/mediaelement/releases/7.x-1.x-dev
Comment #48
jnettikThe patch applies cleanly. However when I configure a video with
100%for the height and width, the player breaks. This needs to be dug into a little more.Comment #49
chris matthews commentedComment #50
bmunslow commentedHi @jnettik,
Can you provide more information on how / when the player breaks?
Screenshots would also be helpful.
Also, try enabling automatic Preload for your video field, let us know!
Comment #52
jnettik@bmunslow: Preload was the key for me. This works as expected. Thanks for the work from everyone on it. Committed!