Windows Media Playback in a Web Page
May 7, 2001
|
I've always wanted to do Interactive TV (ITV), ever since I took my
first crayon and drew on the television. Little did my parents
realize during all the shouting that I was taking a first step in
building my resume. Interactive TV has been slow to develop, but
in the meantime another screen came to be popular in homes, the
computer.
|
Let's face it, watching video on the computer — even at
300kbps — is still an experience only a hard core techie
could love. It isn't going to beat out television. Where things
get interesting is when the video gets combined with other
information or applications that enhance or allow us to
manipulate the video.
In this article, I'm going to show you how to include Windows
Media video in your Web pages. This is your first step to
becoming an Interactive TV programmer.
Putting Video Online
Before you start creating interactive video on the Web you need a
place to host your video. One thing that all articles seem to
neglect is how the average person gets access to a video server
at a reasonable price.
If you have a copy of Windows Media 2000 Server you can install
Windows Media Services yourself and you can run all your testing
locally. But what if you're the average user with a single
computer and slow Internet access? What you need is someone else
to host your video at a price that isn't going to tax your
depleted tech stock portfolio.
Its called Playstream
You can get a free site for 15 days and then rates are as low as
$4.99/month after that. I swear, I'm not associated with them.
They provide online statistics and allow you to grow to be as big
as you want to be. If you come up with some content that is
particularly compelling then they can even set up a pay-per-view
service. Once you get your video online your ready to become an
ITV programmer.
Launching the Player
Video files for
Windows Media
consist of two files. The main video file (.ASF) and a "pointer"
file (.ASX or .WVX) that you use to point to the video server.
For those of you who are
familiar with Real Video
the relationship is the same as the Real Video (.RM) to the RAM
file.
The ASX and the WVX files are the exact same thing and contain
the same information. WVX is simply what Microsoft decided to
call the ASX file in Windows Media 7. To ensure backward
compatibility I would continue to us ASX. All code in this
article will refer to ASX files.
|
|
Pointer File
|
Media File |
|
Windows Media
|
asx or .wvx
|
.asf, wmv, wma |
|
Real Media
|
.ram
|
.rm, ra
|
The simplest way to get video into your Web page is to place a
link to the "pointer" file in your page. The pointer file,
either .wvx or .asx, resides on your Web server with the HTML,
not on the streaming server.
This link will appear exactly like any other link on the page,
but instead of pointing to a new Web page it points to an ASX
file. Once clicked on the browser is smart enough to launch the
Windows Media Player as a stand-alone application and play the
video.
Simple ASX Files
First, let's take a look at a simple ASX file that will serve to
launch your video. In the next section I will discuss the
XML-based
language of the ASX file and show how it can control the video
file.
Place this in your HTML:
<A HREF=" yourfile.asx">Link to Streaming
Content</A>
Here is the file yourfile.asx. This should go in the same
directory as the HTML file that points to it. Create it in
Notepad or your HTML editing program and save it as a normal text
file with the .asx extension.
<ASX version = "3.0">
<ENTRY>
<REF HREF =
"mms://win.playstream.com/jrule/video/sample.asf" />
</ENTRY>
</ASX>
It's that simple. Now remember this doesn't embed the video in
the page; it launches the standalone player. I'll show you
how to embed the video later on.
Complex ASX Files - Page 2
|