Tony said:
I'm working on project that plays movies using Windows Media Player and
I'm controlling everything with JavaScript. Per the client I only need
to support IE 6 or greater which happens to make things a bit easier.
What I need to do is create a playlist and play it using JavaScript. I
keep on getting close but not close enough to play the dang files. Has
anyone done this before and can shed some light on what worked for them?
If your playlist is to be the same every time with one video played
after the other in sequence, your job will be easy and you need not
limit to IE 6 + browsers.
The WMP will play a few types of videos, with .wmv being the most
common. This can use a wvx playlist file to play videos in sequence.
For example the below object is used to play the WMV:
<div style="text-align:center">
<object data="
http://www.cwdjr.info/movie/cancanvbr.wvx"
type="video/x-ms-wvx" style="width:400px; height:309px">
<param name="src" value="
http://www.cwdjr.info/movie/cancanvbr.wvx"
valuetype="ref" />
<param name="showcontrols" value="1" valuetype="data" />
<param name="showstatusbar" value="1" valuetype="data" />
<param name="autostart" value="0" valuetype="data" />
<param name="volume" value="0" valuetype="data" />
<param name="PlayCount" value="1" valuetype="data" />
</object>
</div>
Notice this uses the .wvx playlist file. A .wvx file has an XML
structure and looks like:
<ASX VERSION="3.0">
<ENTRY>
<REF HREF="
http://www.cwdjr.info/movie/CanCanvbr.wmv" />
</ENTRY>
</ASX>
I just put in one video, but you can add as many as you wish using the
same entry-ref-/entry structure as above. The reference points to the
location of the actual .wmv video files.
Now if you want to change around the sequence in which the videos are
played(say allow the viewer to select a play list from several video
choices) you have more of a problem. The WMP is not easy to control
with script if the code is to validate and play on most modern
browsers. However, if you are interested in IE browsers only, as you
state, then you likely can find information concerning scripting the
WMP somewhere on the Microsoft developers site - at least it was there
a few years ago. I wiil not use such code, but many will.
An example of a working page that uses the above mentioned technique is
at
http://www.cwdjr.info/broadbandMedia/formatsOB/cancanWMV.php . The
page is designed for broadband with a bit rate of about 2 Mbps. It
likely will work at much lower rates, but the buffering time will then
become excessive until enough is downloaded to allow streaming to start
without having to stop somewhere to catch up with loading. At least the
player will indicate the progress of buffering so that you know the
video is downloading.