www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] Can't change QuickTime movie with JavaScript

  1. #1
    Join Date
    Nov 2010
    Posts
    8

    resolved [RESOLVED] Can't change QuickTime movie with JavaScript

    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:

    HTML Code:
            <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:

    Code:
        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:

    HTML Code:
    <a href="javascript:document.getElementById('movie1').SetURL(movie2NameNoPath);">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 create the player using 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 to do this.

    Thanks!

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654

  3. #3
    Join Date
    Nov 2010
    Posts
    8

    This has been answered

    Awesome, Fang. I consider myself well answered. I will watch your tutorials with great interest and learn lots! What's so cool about this answer is I now have a friendly way to learn more in JavaScript. I like these forums. I intend to continue coming. I guess I could have searched more carefully before posting my question, however.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles