Open jwdevel opened 1 year ago
Update: the below doesn't actually seem to be necessary. In fact, in my real setup, it causes a (wrong) 16:9 ratio to be forced on plain <video>
embeds, weirdly...
old note:
Note: as a workaround, the following seems to be okay:
pyr__video-embed
from the element markup.var elem = document.getElementById('player');
elem.classList.add("plyr__video-embed");
// ...
const player = new Plyr('#player');
Expected behaviour
When I use a plain
<iframe>
for a YouTube video, and add Plyr support viaplyr__video-embed
(and relevant JS), I'd expect that the element still looks good for visitors who have Javascript disabled.Actual behaviour
Instead, the styling of that
<iframe>
gets messed up until the Plyr JS code runs. The element is stretched to the full width of the window (as far as I can tell).The approach used matches the documentation's recommendation for "progressive enhancement," so it seems especially odd that it behaves poorly when there's no Javascript running. Compare to the plain
<iframe>
approach (noplyr__video-embed
), where lack of Javascript does not mess with the element's size, and displays a simple message from YouTube about needing javascript.Steps to reproduce
Here is a minimal page that shows the issue. You can save locally and view in your browser (I am using FF 102.6.0esr 64-bit).
Environment
Console errors (if any)
None relevant. I do see some from YouTube, since I'm running off of the local filesystem.