Youtube Buffer Video

By Yansky Last update May 20, 2009 — Installed 71,393 times.

Love it

in
Subscribe to Love it 6 posts, 3 voices



JoeSimmons Scriptwright

I love this script but why does it do things that aren't mentioned in the description? I took out the part where it makes you hover the video for it to be seen playing. That's completely pointless I think.

 
Yansky Script's Author


it makes you hover the video for it to be seen playing.

It's not supposed to do that. The hover stuff is there so that you can see the the vertical audio bar if you mouseover the audio level button on the player while it's buffering. I needed to restore the height of the player and hide the preview image so that the vertical audio bar would show.

The hover event listeners and the preview image should be removed once you click the play button, but I guess it's not doing that for whatever reason.

 
alala Scriptwright

I was also annoyed by mouse hovering problems and YouTube Buffer Video's incompatibilities with another YouTube scripts (YouTube HQ + 720p and some player window enlarging script I don't remember), so I made a couple of minor changes for myself. I'm an "on and off" C++ programmer with no JScript experience, but this quick edit seems to have fixed all hovering-related annoyances and enlarged the YouTube media player to the size I wanted. I also want to mention that I was able to imitate the functionality of YouTube HQ + 720p by using the FoxReplace Firefox addon (http://addons.mozilla.org/en-US/firefox/addon/6510). All one needs is a general rule that replaces

http://www.youtube.com/watch?v=
with
http://www.youtube.com/watch?fmt=22&v=
Hope some of you find this a bit helpful, and, Yansky, thanks for the wonderful script.

// ==UserScript==
// @name           Youtube Buffer Video (mod)
// @namespace      userscripts.org
// @description    Autoplay is disabled and it buffers the video .
// @version        0.1
// @include        http://youtube.com/watch*
// @include        http://*.youtube.com/watch*
// ==/UserScript==

(function() {
var css = " @namespace url(http://www.w3.org/1999/xhtml); #watch-other-vids{ position:absolute; top:706px; left:656px; } div.bar, #tab-wrapper, #chrome-promo";
if (typeof GM_addStyle != "undefined") {
	GM_addStyle(css);
} else if (typeof addStyle != "undefined") {
	addStyle(css);
} else {
	var heads = document.getElementsByTagName("head");
	if (heads.length > 0) {
		var node = document.createElement("style");
		node.type = "text/css";
		node.appendChild(document.createTextNode(css));
		heads[0].appendChild(node); 
	}
}
})();

var sGetter = document.createElement('script');
sGetter.type = "text/javascript";
sGetter.innerHTML = "function onytplayerStateChange(){};function onYouTubePlayerReady(){"+
					"var movP = document.getElementById('movie_player');movP.playVideo();movP.pauseVideo();"+
					"movP.addEventListener('onStateChange', 'onytplayerStateChange');};";
document.body.appendChild(sGetter);

var vidID = document.location.toString().split("v=")[1].split("&")[0];
var pD = document.getElementById('watch-player-div');
var mP = document.getElementById('movie_player');
mP.setAttribute("flashvars","autoplay=0&"+mP.getAttribute("flashvars"));
mP.src+="#";
mP.style.height='25px';
mP.style.width='940px';

var altPlayerIMG = document.createElement('img');
altPlayerIMG.setAttribute('id','myytplayerIMG');
altPlayerIMG.src='http://i2.ytimg.com/vi/'+vidID+'/default.jpg';
altPlayerIMG.setAttribute('style','width:940px;height:557px;');
pD.insertBefore( altPlayerIMG, mP );

var cI = true;

unsafeWindow.onytplayerStateChange = function(newState){

	if(newState==1 && cI){

		pD.removeChild(altPlayerIMG);
		mP.style.height='557px';
		mP.style.width='940px';
		pD.removeEventListener("mouseover", pdmousOv, false);
		pD.removeEventListener("mouseout", pdmousOu, false);
		cI=false;
	
	}

}

pD.addEventListener('mouseover', pdmousOv = function(e){

//	altPlayerIMG.style.display='none';
//	mP.style.height='385px';

}, false);
pD.addEventListener('mouseout', pdmousOu = function(e){

//	altPlayerIMG.style.display='block';
//	mP.style.height='25px';

}, false);

 
JoeSimmons Scriptwright

Why doesn't it work on any of expertvillage's videos?

 
Yansky Script's Author


Why doesn't it work on any of expertvillage's videos?

Do you mean on user pages in general or this one for example: http://www.youtube.com/watch?v=_K_Gi2jc5W0

 
JoeSimmons Scriptwright

On any of their videos.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel