Loading HQ
|
|
Couldn't you load HQ video using this instead of a XHR call?
var pauser=setInterval(function(){
if(player=document.getElementById("movie_player")) {
clearInterval(pauser);
if ((vars=player.getAttribute('flashvars')).indexOf('vq='))
player.setAttribute('flashvars', vars.replace(/vq=(1|null)/,'vq=2'));
else
player.setAttribute('flashvars', vars+'&vq=2');
player.src=player.src;
}
},100);It seems so simple to me that perhaps I'm missing something...
|
|
|
yeah that's pretty much exactly what I used to do. but it turns out youtube has different "t" and whatnot variables for each quality of video that is only found on that specific page for the format. maybe they finally sorted out their format mess... i'll check it out and see if the "old trick" works again *(although it never really worked, just seemed to work). |
|
|
yeah I think they've finally sorted it out. now that they have that HQ/HD button on the player this code basically makes that selected. so far it's worked on all the videos I've tried it on. if HD is available then vq=2 makes the video HD and if only HQ is available then vq=2 makes the video HQ. vq=1 or vq=null is the default quality. If you want to make sure you get the right "t" value you could always do a call to http://www.youtube.com/get_video_info?&video_id... and get the "token" value returned by that, or any of the other values you need for that matter. |
|
|
ah sick, i always wondered if they had an api |
|
|
Avindra Gool... wrote: their public api is crap (wouldn't accept the fmt parameter). they should make the get_video_info one public. I discovered it in a call I intercepted with Tamper Data. |
|
|
sizzle thanks a lot, i changed it to the "secret api" you suggested, and then eliminated it alltogether. it seems youtube really finally fixed their shit. thanks for the tip! btw i used the swfArgs object instead of working with regexp's, since it made for easier (and sexier) coding, if i might add :-) |
|
|
Avindra Gool... wrote: lol. sexier indeed. |