View Full Version : How to set video speed options

05-13-2006, 02:58 AM

I would like to ask something, I want to put videos on my website but problems comes i don't know how to set video speed options (Player setting) i.e high speed, low speed, Medium speed for different people who either use broadband connection or lower connection.

Example of what i'm saying here you can find from this this website http://www.blastro.com/player/shakirahipsdontlie.html?detect_mediatype=wmv&detect_bitrate=_300

I will appreciate for your help.


05-13-2006, 05:43 AM
I first thought you meant something along the lines of slowmo and fast forward, but now it makes sense. (By the way, I don't think that's even possible to control that, and only would be if the player had those options and integration with the code... yeah.)

I have no idea if it's possible to get the speed of the user's connection.
The only way I can think of is sending X amount of data, then dividing that by the time to find how long it took.... rate. That wouldn't be reliable and wouldn't work too well, probably.

That link does say "detect_bitrate"... so... there may be something going on there. Might be as above... just detecting via testing speed of sending a tiny bit of data and guessing for more.

Anyway, the way these are generally setup is with a user choice, either by link or radio buttons in a form, and then that is sometimes stored in a cookie that will check the next time and skip the choice. ie, If I choose "high" once, it won't show choices, but will just take me to "high".

That's a FINE option... no need to get fancy with detection and such. Users might prefer it differently anyway.

If there's something I kinda want to watch but not too much, I'll download the bad quality one for speed just so I don't waste time with that if I don't care too much in the first place. And, even if I was using a slow connection, I'd want to see the best stuff at the best quality, even if it did take forever.

Forcing a choice is usually a bad idea.

Also, if you are specifically referring to how the URL itself with "detect_bitrate=300" works, that's just a variable... kinda.

With php, $_GET['detect_bitrate'] is equal to 300 with that example.
With javascript, I'm not sure what the specific method is, but you basically take the address in the URL bar and split it after the ? in the address (like index.php?var=...) so you have the variables left. then, with some slightly complex loops, you set the variables from the address bar to variables in javascript and there you go.

Either way, the content of the page, the video, is generated from that.
Basically... the code will then print "300" or the equivalent URL for a video as the video.

ie if it's 300, then "300.wmv" will be used, not "150.mov", etc.

Basically... you can just go with links and choices and that will be fine. In the end, it works for more people and gives people choices.
Might want to look into cookies and a form, just to be a bit "smoother", I guess. That won't have compatibility issues, but might just be nicer for those who do accept cookies. For the others, they'll just, as if you didn't have the cookies option, have to choose each time they get to the page.