Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embeded Youtube videos are not responsorive. #162

Open
kimwhite opened this issue Oct 27, 2024 · 2 comments
Open

Embeded Youtube videos are not responsorive. #162

kimwhite opened this issue Oct 27, 2024 · 2 comments

Comments

@kimwhite
Copy link
Contributor

When embedding a YouTube video link in the directory or profile page, it shows the full size and is not responsive.
Adding a YouTube link in WordPress will embed the video by default, but it will be responsive.

Example - Profile page the home page.
https://capture.dropbox.com/FoVcYXUvDKfsm1to

@kimcoleman
Copy link
Member

For now the best way to make an oembed responsive is with a CSS trick. Here's a snippet:

https://gist.github.com/kimcoleman/3f21e330adabd5b9ecc0de8cf8462b35

The snippet wraps the field output "value" for a field named "video" in a div we can then target with custom css, assuming the video is 16/9 aspect ratio (most are):

`.video-container {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
max-width: 100%;
}

.video-container iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}`

@kimcoleman
Copy link
Member

We updated core PMPro and the user fields displayValue function.

strangerstudios/paid-memberships-pro@cb82020

Now that embeds are wrapped we can use CSS to style theme.
https://github.com/strangerstudios/pmpro-member-directory/pull/167/files#diff-e82137dac4680230b2cb48de16d94959efe40289273c5e72af95039897dc0077

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants