Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I am using a theme that adjusts according to the device being used (computer, tablet, or smartphone).
Is it possible for me to set things up with your module so that my YouTube videos size changes or adjusts automatically (like small, medium, or large)? If so, I would I do this? If not, any ideas on how I can accomplish this? Thanks for your help.
Comments
Comment #1
RobW CreditAttribution: RobW commentedYou can do this with a css pattern known as Uncle Dave's ol' Padded Box or a little js library like FitVids. There's a Drupal module that helps with using FitVids too, although I prefer to just use the js directly.
Comment #2
glidetothehoop CreditAttribution: glidetothehoop commentedThank you so much!
Comment #3
RobW CreditAttribution: RobW commentedNo problem.
Comment #4
thelee CreditAttribution: thelee commentedhow do you use fitvids for this? I tried using the library and it doesn't work at all; the media: youtube module is embedding fixed width and height on the flash embed which is choking fitvids up.
Comment #5
thelee CreditAttribution: thelee commentedComment #6
RobW CreditAttribution: RobW commentedCan you copy and paste the html here?
Comment #7
thelee CreditAttribution: thelee commentedusing the basic default media: youtube embed, which yields this:
and then with the console I'm just doing:
the element flickers, it gets wrapped by the fitvids wrapper, but nothing actually changes.
EDIT: i haven't had much time to play with this, but my hypothesis is that the flash object is being set with a fixed width and height, which is foiling fitvids's attempts to make it responsive.
Comment #8
RobW CreditAttribution: RobW commentedTry updating M:YT to the dev version which uses an iframe, width and height attributes, and much reduced/improved html. There's currently nothing in the dev that isn't an improvement over the last stable release, so it's safe on production. (Just so you know FitVids has been tested and shown to work many times with the dev version).
Comment #9
aaron CreditAttribution: aaron commentedComment #10
steinmb CreditAttribution: steinmb commentedDid you actually get a solution to this?
Hardcoding the size in px at /admin/structure/file-types/manage/video/file-display/something is not really flexible though using width:100% fail. Fail in that way that I could not find a way to calculate the height.
Comment #11
dmkelner CreditAttribution: dmkelner commentedI just got this to work, so I thought I'd post it for others. If you are using the video field in a view, wrap the field in a div with a class of .video-container. Then use this css:
For some reason, when I just display the node it is wrapped in a video tag instead of an embed, so that is easy enough to style with a simple width:100% and height:auto.