Using JavaScript to change QuickTime movie

Purpose: To create a page that plays different movies depending on which link the user clicks on. Only one player is displayed to play all the movies. Right now the links are text for my convenience but eventually they’ll be images.

Problem: I can’t get the player to change to the second movie. I’m doing this in JavaScript. Here I’m showing it to you as inline script, but it doesn’t work as a function call either.

Question: How do I get this page to change the movie in the player based on the user’s click?

I’ve tried this 2 different ways: creating the playing with manual code and creating it with an Apple-supplied function call.

This is how I create the player manually:

        <object CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" 
           CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" WIDTH="640" HEIGHT="370" id="movie1">
          <PARAM NAME="src" VALUE="video/movie1.mp4" />
          <PARAM NAME="autoplay" VALUE="true" />
          <PARAM name="CONTROLLER" value="true" />
	  <param name="enablejavascript" value="true" />
          <param name="scale' value="aspect" />
          <EMBED SRC="video/movie1.mp4" TYPE="image/x-macpaint" 
            PLUGINSPAGE="http://www.apple.com/quicktime/download" WIDTH="640" HEIGHT="370" 
            AUTOPLAY="true" controller="true" id="movie1"></EMBED>
        </object>

This is how I create the player in JavaScript:

    QT_WriteOBJECT('movie1.mp4' , '100%', '95%', '', 'autoplay', 'true', 'controller', 'true', 'scale', 'aspect', 
     'obj#id', 'movie1', 'emb#name', 'movie1', 'enableJavaScript', 'true'); 

I have this link to change the movie:

<a href="javascript:document.getElementById('movie1').SetURL(movie2Name);">Play 2nd video inline JavaScript without path</a>

Here’s what happens: The player loads and begins playing the movie okay. When I use the manual coding and click on the link, I get an “Error on page” message. This is IE 8. The details are these:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2; WWTClient2)
Timestamp: Wed, 24 Nov 2010 21:46:29 UTC

Message: ‘document.getElementById(…)’ is null or not an object
Line: 56
Char: 3
Code: 0
URI: etc.

When I use the Apple supplied function, I get no error message and it also doesn’t change the movie. The existing movie just keeps playing. I created a bunch of other links to do things like stop the movie, start the movie, rewind the movie, and retrieve the movie URL, and these work in IE for the manual coding but not for the Apple supplied function call. I also tested both versions on the other 4 major browsers. None of them change the movie either, but for the Apple supplied function they will all start the movie, stop the movie and rewind the movie from JavaScript. I can give you that information as well.

I’m probably doing something basic wrong. What is it? I would appreciate any help you can give. I am testing this on a Dell running Windows XP Pro SP3 at work and a Dell running Windows 7 Home Premium at home. Please let me know any other information you need. I do appreciate your taking the time to read this post, as I know it is long and you are not paid.

Thanks!