• We are getting ready to start adding videos to all posts, so I’ve been reading a lot about the best way to embed videos to avoid the dreaded page-load slowdown that results from using the (old) iFrame method provided by YouTube for embed code.

    Several websites I found advocate using javascript and CSS, such as this one that claims this method is both mobile responsive and does not slow down the page load:

    https://www.labnol.org/internet/light-youtube-embeds/27941/

    However, I know that WP now natively supports oEmbed, but what I don’t know is how the oEmbed method compares to the old iframe method as well as the javascript/CSS method in terms of page-load speed….we need the leanest, fastest method possible because many of the posts already have a lot of content, images, etc and we don’t want to slow the page down further when adding video.

    I’ve found lots of info on how to implement each method, but nothing that compares the page load speed between them.

    Thanks for any factual data anyone can share!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator James Huff

    (@macmanx)

    oEmbed isn’t an element itself, it’s basically a protocol which fetches the embed code from the provider, so what you receive will be whatever they feel is best at the time. It could be an iFrame, it could be JavaScript, what is done one way now could change tomorrow.

    The beauty of oEmbed is that you always get the latest player from the provider, but the downside is you lose a bit of control.

    Since your theme and plugins will be responsible for a large amount of the load, I recommend running your benchmarks in the site itself. Create two separate pages (to avoid caching influences), one with the oEmbed, and the other with your other embed method. Then, run those pages through both https://gtmetrix.com and https://www.webpagetest.org for some useful data.

    Thread Starter TrishaM

    (@trisham)

    Thanks James – good suggestions, I’ll give that a try and [eventually] post my findings back here… ??

    Moderator James Huff

    (@macmanx)

    You’re welcome!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘oEmbed vs. javascript for speedy video loads’ is closed to new replies.