Why not apply this same logic to any OneBox’ed source which explicitly specifies its height and width and ultimately gets embedded via an iframe?
Thoughts and Approach
In theory, if we already have the explicit height/width and that’s getting specified on the iframe, the same general approach with setting the aspect ratio could be used to make things scalable generically.
For example, I’ve been embedding more and more video demos in our community, so I switched to Bunny.net, who is known for their CDN, and their Bunny Stream service for uploading and embedding videos.
After adding video.bunnycdn.com
and iframe.mediadelivery.net
to my allowed iframes setting, I can easily paste in a URL from Bunny Stream and it gets OneBox’ed using one of the generic fallbacks… but the aspect ratio gets really funky when viewed on a mobile device.
As a quick workaround, I wrote a simple Theme Component which uses the Plugin API and decorateCookedElement
to update the iframe with the aspect ratio information.