QuickTime Developer Series

Sample Chapter


| Next | Prev | Top |

Launching QuickTime Player from a Text Link

Sometimes it's inconvenient to use a poster movie to launch QuickTime Player. It involves another production step for one thing, and the viewer needs to have QuickTime installed just to see the poster. Starting with QuickTime 5, it's possible to launch QuickTime Player directly from a text link.

It's done using a special MIME type, very much like using QTSRC to prevent hijacking.

Why another MIME type? Because there's no HTML command to open a particular application. All you can do is link to a file--the browser chooses a plug-in or an application that has registered for that file extension or MIME type. External player applications, such as RealPlayer, Windows Media Player, and QuickTime Player, each register a unique MIME type that only they play. You launch a particular player by linking to a file of the appropriate type.

For QuickTime Player, you use a QuickTime link file, file extension .qtl , MIME type application/x-quicktimeplayer . Your text link is an ordinary HTML hyperlink, and it looks like this:

<A HREF SRC="MyMovie.qtl"> Click Here for a QuickTime
Movie </A>

    Important  For this to work, your Web server must be configured to associate the .qtl file extension with the correct MIME type:

.qtl = application /x-quicktimeplayer

A QuickTime link file is basically a new name for a QuickTime movie. QuickTime treats a .qtl file exactly the same as it treats a .mov file. You can change the file extension of any QuickTime movie from .mov to .qtl --QuickTime Player won't mind a bit.

But a browser won't pass .qtl files to the QuickTime plug-in, only to the player. Because when QuickTime 5 or later is installed, it registers QuickTime Player as the only application for .qtl files and for the MIME type application/x-quicktimeplayer .

There are a few drawbacks to this technique. This is a new MIME type, so you have to add it to your Web server's look-up table. That only takes a minute if it's actually your Web server. If not, you may have to convince someone who isn't sure what a MIME type is that it's a good idea, and that can be a tiresome process. In the long run, though, it's not a problem. All of today's streaming media were new MIME types in the recent past. In a little while, all the webmasters will know about .qtl files, and Web servers will come with the MIME type already in their default tables. But if you're an early adopter, you may have to educate some people.

Also, your viewers need QuickTime 5 or later to use this kind of link. Again, that's not a problem in the long run. Over 1.5 million people downloaded QuickTime 5 the first week it was released, so it shouldn't take long to become the norm, especially with the automatic update feature introduced in QuickTime 4. But again, it's something you need to consider.

Finally, when you load a movie using this technique, the browser downloads the movie to the user's hard disk as an ordinary file--not as a temporary cache item--and some browsers wait for the whole file to arrive before calling QuickTime Player. This clutters the disk and prevents the movie from playing while it downloads.

There's a pretty good solution for this last problem. QuickTime supports several different kinds of reference movies--tiny files, typically less than 1 Kbyte, that point to other movies by filename or by URL. QuickTime plays a reference movie by getting whatever it points to and playing that.

Only the tiny reference movie is left on the viewer's disk, and only the reference movie has to download before the browser calls QuickTime Player. It usually takes less than a second for a small reference movie to download. The movie it points to--the real movie--can play while it downloads.

Here are two ways to make a reference movie: one using QuickTime Player, and the other using a text file.

Making a Reference Movie Using QuickTime Player

Just follow the bouncing ball:

  1. Put your actual movie on your Web server.
  2. Open QuickTime Player on any computer with HTTP access to the server (normally any computer with an Internet connection or any computer on your LAN).
  3. Choose Open URL (File menu) and type in the URL of your movie, such as
  4. http://www.myserver.com/movies/MyMovie.mov

  5. Your movie should open. If it autoplays, stop it and rewind it to the beginning. Choose Save (not Save As). This creates a tiny reference movie that's basically a wrapper around the URL of the actual movie.
  6. Quit. Change the file extension of the little reference movie from .mov to .qtl .
  7. Put the reference movie on your Web server and link to it from your Web page like this:
  8. <A HREF="ReferenceMovie.qtl" > Some Text </A>

When a visitor to your website clicks the text, the browser downloads the little .qtl file and hands it to QuickTime Player, which opens the file, reads the URL, and plays MyMovie.mov over the Web. No copy of MyMovie.mov is saved to disk, unless you allow saving and the viewer explicitly chooses it.

Making a Reference Movie from a Text File (XML)

You can also create a .qtl reference movie by typing three lines of text using a text editor or word processor. Actually, you can copy and paste the first two lines because they're always the same.

The syntax may seem a little cryptic, but the process is very simple. If your movie is named My.mov , your text file looks like this:

<?xml version="1.0"?>
<?quicktime type="application/x-quicktime-media-link"?>
<embed src="http://www.myserver.com/Movies/My.mov" />

    Important  Don't leave out the /> at the end of the third line! This is XML, not HTML.

The first two lines tell QuickTime that this is a reference movie. Put the URL of your actual movie in the src parameter on the third line.

The URL can use HTTP, RTSP, FTP, or any protocol QuickTime supports. You can't use relative URLs over the Internet though--the browser gives the file to QuickTime from the default download folder of the local disk; it doesn't tell QuickTime the file's original URL. Relative URLs work only with local movies.

Save this file as plain text with the .qtl file extension.

A nice feature of this kind of reference movie is that you can pass additional instructions to QuickTime Player in the third line. The player understands the following commands:

  •   autoplay="true" | "false" ( @timestamp is not yet supported)
  •   controller="true" | "false"
  •   fullscreen="normal" | "double" | "half" | "current" | "full"
  •   href="url"
  •   loop="true" | "false" | "palindrome"
  •   playeveryframe="true" | "false"
  •   qtnext="url"
  •   quitwhendone="true" | "false"

Just place these commands inside the <EMBED> tag on the third line of the .qtl file. Here's an example:

<embed src="http://a.server.com/aMovie.mov" autoplay ="true" />

You may have noticed two commands for QuickTime Player that don't have equivalents in the HTML parameters for the plug-in-- quitwhendone and fullscreen .

The fullscreen command tells QuickTime Player to use the whole screen to display the movie, using a black background if the movie does not perfectly fit the screen dimensions. For more about full-screen movies, see Full-Screen Movies.

The quitwhendone command tells QuickTime Player to quit when the movie ends, effectively returning the viewer to the browser. When combined with the fullscreen command, this can create a seamless experience in which the QuickTime Player application is almost invisible--the viewer clicks a link, the screen goes black and a movie plays, then the browser window comes back exactly as it was. To see an example, load Fullscreen.mov in your browser (it's in the SpecialDelivery folder of the CD).

The remaining commands behave like their HTML <EMBED> tag equivalents, with the minor exception of autoplay , which doesn't yet support the new autoplay="@hh:mm:ss:ff" delayed-start feature.

You can create other kinds of reference movies in QuickTime, including reference movies that cause QuickTime Player to load different movies based on the viewer's language or Internet connection speed. Using any kind of reference movie allows your intended movie to play while downloading (fast start), and prevents the browser from leaving the movie on the viewer's disk if it's not wanted.

We'll look at the other kinds of reference movies--and some fairly amazing things you can do with them--in the following chapters. Right now let's look at the main reason you would want to launch QuickTime Player instead of using the plug-in: full-screen movies.


| Next | Prev | Top |
Copyright 2002 by Academic Press


Home | Updates | Corrections | FAQ | Table of Contents | Sample Chapter