I was creating a Playlist using JavaScript and populating it on the
fly. Here's what I did to accomplish this. Remeber...I was only doing
this for IE, this probably won't work on FireFox.
/************************************************** *************************************************
Author: Tony Bianco
Usage: You can use this but please have the heart to give me credit I
worked my ass to get this.
Email:
t3********@gmail.com
If you have any questions then keep it to the post...if it just can't
wait then email me.
************************************************** *************************************************/
//USE THIS IN AN EXTERNAL JS FILE
// 'Player' is the id of the media object.
// tell Media Player to request full media access rights
Player.settings.requestMediaAccessRights('full');
// Create an Array for the names of the media files
wmvs = new Array();
wmvs[0] = 'movie1';
wmvs[1] = 'movie1';
wmvs[2] = 'movie1';
// Populate the playlist
for(var index = 0; index <= wmvs.length; index++)
{
// we will add 'wmv/' and '.wmv' to the list
wmvMovie = 'wmv/' + wmvs[index]+'.wmv';
mediaItem = Player.newMedia(wmvMovie);
Player.currentPlayList.appendItem(mediaItem);
}
// To play the movie in the play list we create a function to load the
movie
function LoadMovie(movieIndex)
{
var movieToPlay = Player.currentPlayList.item(movieIndex);
// Check to tried to reload this movie
if(movieToPlay.sourceURL != currentMovie)
{
currentMovie = movieToPlay.sourceURL;
Player.controls.playItem(movieToPlay);
}
else
{// We are playing the current movie
// If the player was paused we play it
if (3 != Player.playState)
{
Player.controls.play();
}
}
// Just for kicks we can add a timer that will show the seconds pasted
in the movie
timer =
window.setInterval("document.getElementById('curre ntPosition').innerHTML
= Player.controls.currentPositionString",1000);
}
<!-- HTML FILE -->
<!--
************************************************** ***********************************
Now if we were to use this on our HTML page we would create the object
and
if we didn't want controls on the page then we would use the param
uiMode
and set it "none". This allows us to set up our own custom controls.
************************************************** *************************************
-->
<object id="Player" width="640" height="480"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<param name="uiMode" value="none" />
</object>
<!-- include your external js code from above AFTER the object tag it
works better here -->
<!-- Now we want a link to load that movie so we do this to play the
second movie -->
<a href="#" onlclick="LoadMovie(1); return false;">Load Second
Movie</a>
This allows you to continously play the play list items from anywhere
in the list.