corbindavenport / superembed.js

Fluid width for YouTube, Vimeo, Vine, VideoPress, DailyMotion, and more embedded videos.
MIT License
609 stars 54 forks source link

Youtube screen only resizes to correct aspect ratio when I resize the browser #11

Open Aeroxander opened 7 years ago

Aeroxander commented 7 years ago

Like I said in the title, when I startup my site it still has black bars, it works well after I resize the window though... I've got an Div over the iFrame, that shouldn't be an issue right?

corbindavenport commented 7 years ago

That would be caused by the DOMContentLoaded event not firing correctly. Try placing the SuperEmbed script tag at the bottom of and see what happens. If that doesn't work, you could try loading JQuery on your page before SuperEmbed, so it will use JQuery to determine when the page is done loading.

Aeroxander commented 7 years ago

Tried both, sadly still not working. I'm going to use an pop-up effect anyway so it doesn't matter personally. Need some code or dodo you know why it doesn't work?

corbindavenport commented 7 years ago

Is the video loaded dynamically (after page load)?

Aeroxander commented 7 years ago

Yeah it is, I use the youtube API

corbindavenport commented 7 years ago

Ah okay. SuperEmbed doesn't work right away with dynamically-added content. I'll try to add some sort of workaround for this.

Uranbold commented 7 years ago

I think this plugin need calling and force the width and height of iframe to correct Aspect Ratio ;)