Pages full of Youtube embedded videos lags

Olly Gunnar Solskjær

Marxist bacon-hating kebab-dodging Tinder rascal
Scout
Joined
Jan 26, 2008
Messages
36,885
Location
dreams can't be buy
EDIT: Good solution in post #5.

On the old vBulletin forums if a Youtube video was embedded within a spoiler it wouldn't load until the spoiler was opened, but the one we have on Xenforo loads it anyway, so whether a Youtube video is in the spoiler or not, if there are a lot of videos on the page it's a pain to load and to scroll down.

If there a possibility of this code, &controls=2, being added to the Youtube embed code?

EG: The current embed link - http://www.youtube.com/embed/dQw4w9WgXcQ?wmode=opaque

Would turn into this - http://www.youtube.com/embed/dQw4w9WgXcQ?wmode=opaque&controls=2

All it does, is instead of loading the flash player straight away, it just shows the JPG video thumbnail and when you click on it, then the video loads.

Or, this does a similar thing and is a script provided by Google - http://www.skipser.com/p/2/p/youtube-video-embed-like-google-plus.html
 
I don't see any gifs in here. What do you think you're playing at, Olly?
smrfe4n.gif
 
Someone on StackOverflow has helped me out with a script for Greasemonkey to hide Youtube videos behind a button.

Like this;

ytmtjie.jpg


Here it is for anyone that's interested
Code:
// ==UserScript==
// @name    RedCafe - Hide Youtube videos behind button
// @include  https://www.redcafe.net/*
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require  https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant    GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
    introduced in GM 1.0.  It restores the sandbox.
*/
waitForKeyElements ("iframe[src*='youtube.com']", hideYoutubeVideo);
 
function hideYoutubeVideo (jNode) {
    if ( ! jNode.hasClass ("gmSpoiledAlready") ) {
        jNode.addClass ("gmSpoiledAlready");
 
        var srcCode    = jNode[0].outerHTML;
 
        jNode.after ('<button class="gmYT_hide" style="background:#d00000; color: #ffffff; font-weight:bold; border:1px solid #b80202; border-radius: 3px; padding:2px;">Show YouTube video</button>');
        jNode.next ('button').data ("frmCode", srcCode);
        jNode.remove ();
    }
}
 
//--- Activate any and all of the spoiler buttons
$(document.body).on ("click", "button.gmYT_hide", restoreYoutubeVideo)
 
function restoreYoutubeVideo (evnt) {
    var jThis  = $(evnt.target);
    var frmCode = jThis.data ("frmCode");
 
    jThis.replaceWith (frmCode);
}
 
That's brilliant. Thanks Olly and StackOverflow person.

Yeah, I tried entering that Platformers thread when it had about 14 replies and my browser pretty much crashed so I exited :lol:
 
How do I make that script work?

1) Install this - https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
(If you are using Chome, use Tampermonkey)

2) Go here - http://userscripts.org/scripts/show/181354, and click on Install. Done!

Old instructions
1) Install this - https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
2) When installed, click the arrow next o the Greasemonkey icon and click on "New user script..."

gmy0uxl.jpg


3) In the Name, Namespace, Description, Includes and Excludes boxes, type anything, just the number 1 in each box will do as it'll be deleted in a second anyway.

4) In the text editor that loads, delete everything in there, and in it's place paste the code from the post above. Save it and close the box. It should be working now.
 
EDIT: Good solution in post #5.

On the old vBulletin forums if a Youtube video was embedded within a spoiler it wouldn't load until the spoiler was opened, but the one we have on Xenforo loads it anyway, so whether a Youtube video is in the spoiler or not, if there are a lot of videos on the page it's a pain to load and to scroll down.

If there a possibility of this code, &controls=2, being added to the Youtube embed code?

EG: The current embed link - http://www.youtube.com/embed/dQw4w9WgXcQ?wmode=opaque

Would turn into this - http://www.youtube.com/embed/dQw4w9WgXcQ?wmode=opaque&controls=2

All it does, is instead of loading the flash player straight away, it just shows the JPG video thumbnail and when you click on it, then the video loads.

Or, this does a similar thing and is a script provided by Google - http://www.skipser.com/p/2/p/youtube-video-embed-like-google-plus.html


Cheers for the heads up on this Olly, sorry for the delay in doing anything about this.

I've added the extra param to the YouTube URL so now the JPG thumbnail is shown.

 
That's brilliant. Thanks Olly and StackOverflow person.

Yeah, I tried entering that Platformers thread when it had about 14 replies and my browser pretty much crashed so I exited :lol:


Which topic is this exactly?
 
Cheers for the heads up on this Olly, sorry for the delay in doing anything about this.

I've added the extra param to the YouTube URL so now the JPG thumbnail is shown.


Just tried loading the first page of the platformer thread that's full of videos and it's so much better, thanks :)