Problem/Motivation
When adding an oembed remote video with the media module, the resulting video always displays at width 200px height 113px.
This is unlikely to be the desired outcome.
It is likely that most people will expect the video to display at the smaller of 100% width (of the content area) or the original width of the media in px, and maintain the original correct aspect ratio.
#3060968: Some oEmbed videos do not maintain aspect ratio has some examples of alternate .css in comment 27 and 62 to address the issue.
However this suffers from an assumption as to the desired ratio of the source video.
Steps to reproduce
This can be seen on any clean install of Drupal 10.x
1. Install Drupal
2. Enable the media module.
3. Insert a media field into the basic page content type
4. Create a content item with a remote oembed youtube video
It can be observed here:
https://tugboat10-radtonmrxxuykt76b3oveqdu9pp4zqwg.tugboatqa.com/node/59
Proposed resolution
Two potential solutions:
- Alter the attributes of the iframe & its parent in PHP to add inline styles
- Add JavaScript that adds inline styles to set the aspect ratio of the iFrame's parent