• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 Slow page loading on threads with many videos

Chris D

XenForo developer
Staff member
#2
The slowness here stems from (in this case) YouTube which is serving up a lot of content as a result of embedded videos.

There is something that can improve performance.

By default, the BB Code Media Site HTML serves Flash for YouTube videos. You may see some improvement if you switch this to YouTube's HTML 5 player. In this case it tries HTML 5 first, and if the browser is not HTML 5 capable, I believe it degrades back to using Flash.

So in Admin CP > BB Code Media Sites > YouTube

Change Embed HTML to:

HTML:
<iframe width="500" height="300" src="http://www.youtube.com/embed/{$id}?wmode=opaque&html5=1" frameborder="0" allowfullscreen></iframe>
 

Chris D

XenForo developer
Staff member
#4
I dunno. It seems a little less sluggish.

When I first tried it, the page kept freezing as I scrolled down.

Since you made the change it seems less-so.

But aside from that, there's not a lot we can do. XenForo isn't doing anything at this point. It's just loading its own content. The HTML is already embedded and so it's your browser that goes off to YouTube to fetch the videos and the video player. So the factors involved are your browser, your connection to the internet and the response times from Google.
 

Adam Howard

Well-known member
#5
The slowness here stems from (in this case) YouTube which is serving up a lot of content as a result of embedded videos.

There is something that can improve performance.

By default, the BB Code Media Site HTML serves Flash for YouTube videos. You may see some improvement if you switch this to YouTube's HTML 5 player. In this case it tries HTML 5 first, and if the browser is not HTML 5 capable, I believe it degrades back to using Flash.

So in Admin CP > BB Code Media Sites > YouTube

Change Embed HTML to:

HTML:
<iframe width="500" height="300" src="http://www.youtube.com/embed/{$id}?wmode=opaque&html5=1" frameborder="0" allowfullscreen></iframe>
@Mike this improved page load speed up dramatically for me. Can we please make this the default in XenForo 1.3 ?
 

Chris D

XenForo developer
Staff member
#6
I think @Mike has stated elsewhere that changing BB Code Media Sites is tricky because they are customisable without any sort of version control. Many people have altered their default embed code. Some may have put wrappers around the videos, changed the settings of them etc.

So it's unlikely it will change for upgrades. Though, of course, it could be updated for new installs.

But I would support a suggestion for the system being improved somewhat so it had some sort of version awareness. @Kier or @Mike might one day consider something whereby you have a master embed code, and that can be updated across XenForo versions without immediately deleting any customisations. Maybe a very simple auto-merge would inspect the old master with the current value and if they match, the new updated value can overwrite that, alternatively mark it as outdated and leave it to the Admin to decide which version they want to keep.

Should be quite a simple change.

There are people out there who still use the old embed code which I believe may have shipped with XenForo 1.0. The one based on <object> tags. I guess there's never a guarantee as to how long that will work reliably for. YouTube still offer it as an option, but that doesn't meant to say they always will.

EDIT: Just found a bit of a show stopper. The HTML 5 player does not gracefully fallback to the flash based player, as I thought it did.

This means that a change like this would affect XenForo's reported compatibility with Internet Explorer 8.

upload_2013-12-13_13-28-7.png

Might be something we see in XenForo 2.0 perhaps.
 

Chris D

XenForo developer
Staff member
#8
Not off the top of my head.

You may want to read my edit. If you're bothered about Internet Explorer compatibility you may want to stick to your existing code.
 

Mike

XenForo developer
Staff member
#10
The iframe has been used for all default embed codes for some time -- some since 1.1, some since 1.2. Some cases can be updated automatically (particularly when the old code no longer works).