One great thing about swooshed links is they behave just like regular links, and thus can be put anywhere a regular link goes -- such as into an embedded video player. To put an embedded video player on your website (whether or not it's powered by a swooshed link), follow along.
The first thing to do is to embed the video player itself into your page. To get started, just embed the original, unswooshed link (and thus make sure everything is working before bringing Red Swoosh into the equation). Though there are as many ways to do it as browsers in the sky, the best way we could figure out to do it follows:
<OBJECT width="320" height="287" id="MediaPlayer"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
codebase=
"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab##Version=6,4,5,715"
standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">
<PARAM value="http://www.redswoosh.net/media/video/test.wmv" name="FileName"/>
<EMBED width="320" height="287"
src="http://www.redswoosh.net/media/video/test.wmv"
name="MediaPlayer" type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"/>
</OBJECT>
Next just take the original link (in this case our trusty, somewhat dusty test video http://www.redswoosh.net/media/video/test.wmv), and stick http://edn.redswoosh.net in front of it. Tah-dah! It's swooshed. The result looks like this:
Click it. Come on, you know you want to. If you aren't already installed, you'll be prompted to do so now. Otherwise, when you click the link it should behave exactly like when you click on the original, unswooshed link above. Indeed, for a fun test, right-click on the properties of the video as it's playing and verify it's coming from http://127.0.0.1:9421 -- a clear sign that something magic is going on, and that magic is Red Swoosh.

Now, to bring it all together, use the same embedded video code we have above, but replace the link with its swooshed equivalent. As you'll no doubt discover, it continues to work, just like before. But unlike before, the video is downloaded and streamed in realtime from peers -- taking the load of your servers. How's that for a neat trick?
<OBJECT width="320" height="287" id="MediaPlayer2"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
codebase=
"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab##Version=6,4,5,715"
standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">
<PARAM value="http://edn.redswoosh.net/www.redswoosh.net/media/video/test.wmv" name="FileName"/>
<EMBED width="320" height="287"
src="http://edn.redswoosh.net/www.redswoosh.net/media/video/test.wmv"
name="MediaPlayer2" type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"/>
</OBJECT>
But wait, there's more! You might have noticed in step 3 that the content is actually being downloaded from 127.0.0.1 (aka "localhost") rather than from the webserver. The details of why this is the case are so incredibly exciting that I won't bother you with them here. But you should know that because of this, Windows Media Player tends to think the file is coming from over the internet, even when in fact it's already been downloaded to your computer. (Remember how I said "it behaves exactly like a normal link?") What this means to you is that the video can take a moment to start playing, because it's "prebuffering" the file on the assumption that the network might hiccup -- a common occurance on the internet but unlikely when reading straight from disk.
To eliminate this slight delay and provide an experience that's even more instant, check out the 'rs_localURL' attribute of the JavaScript API. The specifics of this are outside the scope of this tutorial, but the basic process includes:
redswooshInitialize until you've verified that the client is runningredswooshDownloadFile to begin downloading the file (if it hasn't been already)redswooshUpdateAttributes to get a list of files downloading in the rs_fileAttributes global variablers_fileAttributes['http://www.redswoosh.net/media/video/test.wmv']['rs_status'] equals 'COMPLETE', indicating that the file has completed downloading (else you'll begin playing a file from disk before it's been fully downloaded, and all sorts of bad things will happen).rs_fileAttributes['http://www.redswoosh.net/media/video/test.wmv']['rs_localURL']
This page has been viewed times.
Page Information
|
Wiki Information
|
![]() Update to PBwiki 2.0 An entirely new PBwiki experience, including folders and easier editing. |