This section describes some applications of HTML scripting for QuickTime and provides examples.
Note: The applications and examples in this section show the object and embed tags as in-line HTML. However, it is recommended that you pass the attributes to the Apple-provided JavaScript function, as described in “Doing It the Easy Way.”
Local Delivery (FILE), Progressive Download (HTTP), and Streaming (RTSP)
Reference Movies
Poster Movies
Launching QuickTime Player from a Web Page
Playing Non-QuickTime Content in QuickTime
There are three ways to deliver QuickTime content through a browser: from a local disk, as a progressive download over a network, or as one or more real-time streams. There are advantages and considerations with each method.
Local disk delivery is simple and places very few limits on movie size or bandwidth. Not all QuickTime movies can be delivered by progressive download or as real-time streams, but any movie can generally be downloaded in some manner and played from a local disk.
The primary concern with delivering QuickTime content as a website on a disk is that browsers are typically optimized to work over networks, not with local content. Browsers typically cache incoming multimedia to disk and play it from disk. This works well over a network, but locally it can result in the browser copying a file from the local disk into a cache on the same disk and simultaneously trying to play the movie from the cache; the combined bandwidth demands on the disk may result in a long delay before the movie begins, as the browser may stall until the entire file has been copied into the cache. To prevent this, use the QTSRC parameter and the QTSRCDontUseBrowser parameter to tell QuickTime download the movie directly, bypassing the browser. Listing 1-2 shows how this is done.
Listing 2-2 Preventing unnecessary local caching by the browser
<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" |
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" |
HEIGHT=yy |
WIDTH=xx |
> |
<PARAM NAME="SRC" VALUE="SmallMovie.mov" > |
<PARAM NAME="QTSRC" VALUE="MyMovie.mov" > |
<PARAM NAME="QTSRCDontUseBrowser" VALUE="True" > |
<EMBED SRC="SmallMovie.mov" |
QTSRC="MyMovie.mov" |
QTSRCDontUseBrowser="True" |
HEIGHT=yy WIDTH=xx |
TYPE="video/quicktime" |
PLUGINSPAGE="http://www.apple.com/quicktime/download/" |
/> |
</OBJECT> |
-- or (the easy way) -- |
<script language="javascript"> |
QTWriteObject('SmallMovie.mov', 'xx', 'yy', '', 'QTSRC', 'MyMovie.mov', 'QTSRCDONTUSEBROWSER', 'True'); |
</script> |
In the preceding example, a small movie file named SmallMovie.mov is used to entice the browser to load the QuickTime plug-in. This should be a very small movie file, such as would be created by opening a single-pixel GIF in QuickTime Player (Pro version) and saving as a self-contained movie. The actual movie to be played is passed in the QTSRC parameter, and QuickTime is told not to use the browser to obtain the movie by the QTSRCDontUseBrowser parameter.
Another problem with websites on a disk is absolute addressing of local URLs; this problem is not specific to QuickTime, but it is a common irritant. The absolute URL of a local file includes the disk name and possibly a drive letter that may not be knowable in advance. For example, a movie located on a CD might have an absolute URL of File:///D:\Movies\MyMovie.mov on one computer, but have a different drive letter, or no drive letter, when mounted on a different computer.
The usual answer is to use relative addressing. Relative addressing specifies the path from the document containing the link to the desired document. For example, if a movie in the Sites\Movies folder is referenced by a web page in the Sites\HTML folder, the relative path would be ..\Movies\MyMovie.mov.
In cases where a relative path is problematic, such as a URL that is used in a JavaScript included in multiple folders with different relative paths to the target file, root-relative addressing may be useful. This requires the HTML author to know the location of the target file relative to the root file of the disk, but this may be acceptable for use on a CD or DVD, for example. Root-relative addresses begin with the forward slash character (/). For example, the root-relative path to our example file might be /Sites\Movies\MyMovie.mov.
Progressive download, or fast start, is the easiest and often the best way to deliver QuickTime content over the Internet. The user experience is very similar to streaming video, but it is more robust and supports a richer set of media types.
Note: Technically, progressive download is a type of streaming, but the term can be confusing, so it is not used to describe fast-start movies. In the QuickTime documentation, streaming refers to real-time streams sent using RTSP and RTP protocol. Nevertheless, many people find the experience of progressive download indistinguishable from real-time streaming and use the term “streaming video” to include progressive download.
To use progressive download, simply place a QuickTime movie on a web server, verify that the server’s MIME type table includes an entry for the .mov file extension set to video/quicktime, and embed the movie in a web page using an http:// URL, as shown in Listing 1-3.
Listing 2-3 Embedding a movie for progressive download from a web server
<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" |
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" |
HEIGHT=yy |
WIDTH=xx |
> |
<PARAM NAME="src" VALUE="MyMovie.mov" > |
<EMBED SRC="MyMovie.mov" |
HEIGHT=yy WIDTH=xx |
TYPE="video/quicktime" |
PLUGINSPAGE="http://www.apple.com/quicktime/download/" |
/> |
</OBJECT> |
-- or (the easy way) -- |
<script language="javascript"> |
QTWriteObject('MyMovie.mov', 'xx', 'yy', ''); |
</script> |
The movie should play as it downloads over the network, provided the network bandwidth is greater than the movie data rate.
If the bandwidth is less than the movie data rate, the viewer sees the first frame of the movie and a progress bar indicating how much has downloaded and how much remains. The viewer can press the Play button at any time to play as much of the movie as has downloaded. This does not interrupt the download. If the AutoPlay parameter is set True, the movie will begin playing as soon as QuickTime calculates that the remaining data will arrive by the time it is needed. This allows you to deliver movies of arbitrary quality to viewers with any speed connection, albeit with delay in some cases.
Note: If the movie data rate is n times larger than the bandwidth, the portion of the movie that must download before the movie autoplays is roughly (n - 1) / n. For example, if the data rate is 1.5 x the available bandwidth, the movie will start when 1/3 of the file has downloaded (1.5 - 1 = 0.5, 0.5 / 1.5 = 1/3).
For a movie to play as it downloads over a network (progressive download), the movie must be saved with the movie header information (also known as the Movie atom) at the beginning of the file, with the media data stored in order of presentation, either in separate files or interleaved in the movie file. This is the default manner in which QuickTime movies are stored, but you may encounter movies that are not stored this way.
Sometimes the movie header information is stored at the end of a file, in which case the entire file must download before the movie can begin playing. If you experience a long delay before a movie begins, this may be the problem. If you examine the file using a hex editor or a sophisticated text editor, you will see the string 'moov' near the beginning of a properly formatted movie file. If the 'moov' string is located near the end of the file, the movie will not fast start and cannot play as it downloads. In most cases, the solution is simply to open the movie in a QuickTime editor, such as QuickTime Player (Pro version), and save the movie as a self-contained file. This process defaults to save the movie header at the beginning of the file, followed by interleaved data.
Real-time streams deliver movies at a fixed data rate, so, for example, a one-minute movie streams across a network in the same one minute that it takes to play. Streaming allows you to transmit live data, such as the output of a camera and microphone, or simulated live data, such as a playlist of recordings, in real time. If you need to send live transmissions, streaming is the delivery method to use.
Streaming is designed to support multicasting, which allows you to send a single stream to multiple receivers simultaneously, much like a radio or television broadcast. The combination of live transmission and multicasting make streaming an ideal solution for efficient viewing by an audience over an IP network, as there is only a single copy of the stream on any part of the network, instead of a copy for each viewer.
Multicasting is not fully supported over the Internet at this time, but it is supported by most routers and can be enabled on most corporate or educational campuses.
A streaming movie arrives as a stream of time-stamped packets. After a packet is displayed, or if a packet is delayed in transit and arrives after it should be displayed, the packet is discarded. A local copy of the whole movie is not stored. This makes streaming movies inherently more difficult to copy than progressive-download movies and is one of the main reasons some people choose streaming instead of progressive download for pre-recorded movies.
The fixed data rate of real-time streams also makes for very predictable server load and bandwidth requirements.
QuickTime streaming supports audio, video, and text (including HREF tracks). Other media types, such as Flash, VR Panoramas, and animated sprites, must be delivered locally or by progressive download.
Note: It is possible to author movies that contain both streaming media and local or progressively downloaded media; a discussion of the authoring methods falls outside the scope of this document, however.
Streaming movies are requested using one protocol on one set of ports, and delivered using a different protocol on another set of ports. Streaming movies are specified using RTSP:// (real time streaming protocol) URLs. Movies are delivered as one or more streams, typically using RTP:// protocol, which in turn uses UDP datagram packets; however if the viewer is behind a firewall or NAT router that does not allow incoming traffic on the RTP ports, or does not allow incoming UDP traffic, the streams may be delivered using HTTP on port 80 instead.
If you are configuring a router that uses Network Address Translation, or NAT (sometimes called “masquerading”) and want to allow streaming content, open ports 6970-6999 to incoming RTP/UDP traffic, in response to outgoing RTSP requests on port 554.
Not all web servers can send realtime streams. A streaming server must be capable of handling RTSP requests and delivering standards-compliant RTP streams. Streaming server software and web server software can run simultaneously on a single computer, however. Streaming server software for Mac OS X, as well as open source streaming server software for other operating systems, are available from Apple at http://www.apple.com/quicktime/streamingserver/.
For a movie to be transmitted as one or more real-time streams, the movie must have a data rate less than the available network bandwidth. If the user has a slower connection than the movie’s data rate, the movie breaks up or does not play. Use compression software to compress your movies to one or more desired bandwidths. Most compression software supports the creation of “reference movies,” playable QuickTime movies that detect the user’s connection speed and select the best streaming movie available from a set of movies compressed at different rates.
In addition, QuickTime movies must be “hinted” for streaming. The process of hinting creates a hint track for each media stream. The hint track is used by the streaming server to determine how to divide the movie data into packets. Most applications that create QuickTime movies can be configured to create movies with hint tracks as part of the compression process. You can also add hint tracks to an existing movie by opening the movie in a QuickTime editor such as QuickTime Player (Pro version) and exporting as a hinted QuickTime movie.
If you have the Mac OSX Server software, you can use QTSS Publisher to compress media for transmission over the Internet at a particular bandwidth, add hint tracks to your movies, generate playlists, upload files to your streaming server, and generate the necessary HTML to embed the movies in a web site, all automatically.
Adding hint tracks increases the file size of a movie somewhat, so movies with hint tracks should generally not be used for progressive download, although there is nothing that actually prevents this.
Once you have hinted a movie and uploaded it to a streaming server, you are ready to embed the movie in your web page. Programs such as QTSS Publisher can generate the necessary HTML for you. If you need to generate or modify the HTML yourself, you should read the rest of this section.
Simply embedding the URL of a streaming movie in your web page does not produce predictable results, because many browsers route all RTSP:// URLs to whatever application has most recently registered as being able to handle RTSP:// protocol. The user may have multiple applications or plug-ins registered for RTSP, and you cannot rely on QuickTime being the most recent to register.
The solution is to embed a small progressive-download movie; this causes the browser to load QuickTime, and you can then make QuickTime request the real-time streams. There are several variations on this technique:
Create a reference movie—a small movie that detects the user’s connection speed and chooses an appropriate stream from a list of URLs. See “Reference Movies.”
Use any small movie in the SRC parameter and specify the streaming URL in the QTSRC parameter. See “QTSRC and ClassID.”
Embed a QuickTime Media Link—a small XML file that specifies the streaming URL—saved with the .mov file extension, so it appears to the web server and browser to be a QuickTime movie. See “QuickTime Media Links.”
Create a text file that contains RTSPtext followed by an RTSP URL and save it with the .mov file extension, so it appears to the web server and browser to be a QuickTime movie, then embed this “movie” in your web page. See “Text Hacks.”
A reference movie is a small QuickTime movie that contains a list of URLs and associated minimum requirements, typically a list of QuickTime movies compressed at different data rates and the minimum data rate required for each movie. When the user plays a reference movie, the reference movie checks the user’s system capabilities and loads the appropriate URL. It is possible to create reference movies that provide different content depending on the user’s Internet connection speed, screen bit-depth (number of colors available), CPU (Intel or non-Intel), and so on.
Most compression software has an option for creating a reference movie automatically when you choose to compress a QuickTime movie at multiple data rates.
There are also free utilities available for download on the Internet that can create reference movies, including MakeRefMovie (developer.apple.com/quicktime/quicktimeintro/tools/) and XMLtoRefMovie (www.hoddie.net).
Once you have a reference movie, embed it as you would a progressive-download movie:
Listing 2-4 Embedding a reference movie
<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" |
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" |
HEIGHT=yy |
WIDTH=xx |
> |
<PARAM NAME="src" VALUE="RefMovie.mov" > |
<EMBED SRC="RefMovie.mov" |
HEIGHT=yy WIDTH=xx |
TYPE="video/quicktime" |
PLUGINSPAGE="http://www.apple.com/quicktime/download/" |
/> |
</OBJECT> |
-- or (the easy way) -- |
<script language="javascript"> |
QTWriteObject('RefMovie.mov', 'xx', 'yy', ''); |
</script> |
The reference movie seamlessly replaces itself with the movie that best matches the user’s computer. To the user, the experience of playing a reference movie is generally indistinguishable from playing the movie that the reference movie selects.
Because QuickTime loads any URL in the reference movie internally, without using the browser, you can safely reference RTSP URLs of streaming movies that you want to be played by QuickTime.
If any movies on the reference movie’s list have dissimilar pixel dimensions, be sure to allocate enough height and width to accomodate the largest movie, including any controller, and set the background color to best fill any unused portion of the allocated space (see BGCOLOR).
Note: URLs cannot cross local/remote zone boundaries. In other words, a local movie (file:// protocol) can invoke only local URLs, such as another local movie, and remote movies (http://, https://, or rtsp:// protocol) can invoke only remote URLs, such as another remote movie or a web page. Furthermore, remote URLs are restricted to http://, https://, and rtsp:// protocols. Other protocols, such as javascript://, are prohibited.
One of the most versatile techniques for scripting QuickTime in HTML is to use a poster movie. A poster movie is a small QuickTime movie, typically a still image, with an associated HREF. When the viewer clicks the poster movie, QuickTime loads the URL specified in the HREF. You can use this technique to achieve several tasks:
Give the user warning before downloading a multi-megabyte movie.
Allow the user to choose from a selection of movies without downloading them first.
Launch the QuickTime Player application.
Play a movie in full-screen mode (uses QuickTime Player).
Load a web page or other URL, optionally in a named frame or window.
Play streaming content.
Use QuickTime to play content that is not QuickTime-specific, such as MP3 audio or MPEG-4 video.
Note: URLs cannot cross local/remote zone boundaries. In other words, a local movie (file:// protocol) can invoke only local URLs, such as another local movie, and remote movies (http://, https://, or rtsp:// protocol) can invoke only remote URLs, such as another remote movie or a web page. Furthermore, remote URLs are restricted to http://, https://, and rtsp:// protocols. Other protocols, such as javascript://, are prohibited.
A poster movie is generally a still image, but it can also be a short clip (in which case it typically loops). A poster movie serves three main purposes: it causes the browser to load QuickTime, it reserves a space on the page for a movie to play, and it acts as a button that responds to the user.
You can turn almost any still image, such as a JPEG or GIF, into a QuickTime movie simply by opening the image in a QuickTime editor and saving as a self-contained movie. Alternatively, you can copy a single frame or a short clip from a QuickTime movie and save it as a self-contained movie. You can also copy a frame from a movie and paste it into an image editing program such as PhotoShop. This allows you to do things such as add text to the image (”Click here to launch the movie”). You can save the image in any format that QuickTime can import, then open the image in QuickTime and save as a self-contained movie.
If the poster movie is used to launch another movie that will display in the same space, the poster movie should be same size as the movie that will replace it (plus 16 pixels vertically, if the movie that replaces it will have a controller). So, for example, if you copy a frame from a movie and paste it into a graphics editor, you should normally add an 8-pixel stripe to the top and bottom of the poster before saving it.
Embedding a poster movie is essentially the same as embedding other QuickTime movies, with the following additions:
A poster movie is displayed without a controller (CONTROLLER="False").
A poster movie has an HREF parameter, specifying its action (HREF="URL").
A poster movie has a TARGET parameter, specifying its target (TARGET="Target" or T<target>).
If the poster movie is a short clip, rather than a still image, it needs to autoplay and usually to loop (AutoPlay="True"Loop="True" or Loop="Palindrome").
An example of the HTML for a poster movie is shown in Listing 1-5
Listing 2-5 Poster that turns into a movie
<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" |
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" |
HEIGHT=yy |
WIDTH=xx |
> |
<PARAM NAME="src" VALUE="PosterMovie.mov" > |
<PARAM NAME="CONTROLLER" VALUE="False" > |
<PARAM NAME="AutoPlay" VALUE="True" > |
<PARAM NAME="Loop" VALUE="True" > |
<PARAM NAME="HREF" VALUE="URL" > |
<PARAM NAME="TARGET" VALUE="myself" > |
<EMBED SRC="PosterMovie.mov" |
HEIGHT=yy WIDTH=xx |
TYPE="video/quicktime" |
PLUGINSPAGE="http://www.apple.com/quicktime/download/" |
CONTROLLER="False" |
AUTOPLAY="True" |
LOOP="True" |
HREF="URL" |
TARGET="myself" |
/> |
</OBJECT> |
-- or (the easy way) -- |
<script language="javascript"> |
QTWriteObject('PosterMovie.mov', 'xx', 'yy', '', 'CONTROLLER', 'False', 'AUTOPLAY', 'True', 'LOOP', 'True', 'HREF', 'Url', 'TARGET', 'Myself'); |
</script> |
When embedding a poster using the target value myself, allocate the correct height and width for the largest movie that will play, including any controller.
You can embed multiple poster movies on a single page, each with a different HREF parameter value, to give the user a menu of larger movie files without loading any large files until the user requests one.
The HREF parameter associated with a poster movie determines what happens when the poster is clicked. The HREF parameter can be set either to a URL or a line of JavaScript.
Important: A relative URL in an HREF parameter must be relative to the postermovie, not relative to the surrounding web page.
When the TARGET parameter is set to Myself, the URL loads in the QuickTime plug-in, replacing the poster movie. When set to QuickTimePlayer, the URL loads in the QuickTime Player application.
If the TARGET parameter is set to Myself or QuickTimePlayer, QuickTime handles any URL passed in the HREF parameter directly.
To play RTSP streams or file types other than QuickTime movies (such as .mp3, .mp4, .swf, .png, or .wav), use a poster movie with the TARGET parameter set either to Myself or QuickTimePlayer. Because QuickTime handles the URL directly for these TARGET settings, the stream or file opens in QuickTime, regardless of the application or plug-in registered with the browser to handle that file type or protocol.
If the TARGET parameter is set to a frame or window name, or is not set, QuickTime passes the URL to the browser for resolution. In this case, the URL should always specify something the browser can display directly, such as a web page.
If the HREF parameter contains a line of JavaScript, QuickTime passes it to the browser.
To load a QuickTime movie in a named frame or window, or in a new window created by JavaScript, create a small HTML page that embeds the movie directly and pass the URL of the page in the HREF tag. This indirection is necessary because the browser handles the URL in these cases, so the <EMBED> and <OBJECT> tags are required to assure that the browser uses QuickTime to display the movie.
You can cause the HREF parameter to execute when the poster movie is loaded, instead of waiting until a user clicks the movie, by setting the AutoHREF parameter to True.
To launch QuickTime Player from a web page, embed a poster movie in the web page with the URL of the content in the HREF parameter and the TARGET parameter set to QuickTimePlayer. For example:
<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" |
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" |
HEIGHT=yy |
WIDTH=xx |
> |
<PARAM NAME="src" VALUE="PosterMovie.mov" > |
<PARAM NAME="CONTROLLER" VALUE="False" > |
<PARAM NAME="HREF" VALUE="URL" > |
<PARAM NAME="TARGET" VALUE="QuickTimePlayer" > |
<EMBED SRC="PosterMovie.mov" |
HEIGHT=yy WIDTH=xx |
TYPE="video/quicktime" |
PLUGINSPAGE="http://www.apple.com/quicktime/download/" |
CONTROLLER="False" |
HREF="URL" |
TARGET="QuickTimePlayer" |
/> |
</OBJECT> |
-- or (the easy way) -- |
<script language="javascript"> |
QTWriteObject('PosterMovie.mov', 'xx', 'yy', '', 'CONTROLLER', 'False', 'HREF', 'Url', 'TARGET', 'QuickTimePlayer' ); |
</script> |
The HREF parameter can point to anything that QuickTime can play—a QuickTime movie, a SMIL file, a Flash .swf file, an MP3 audio file or MPEG-4 video file, and so on.
You can pass parameters to the QuickTime Player application by creating a QuickTime Media Link, a small XML file that includes the movie’s URL and the parameters you wish to pass. This XML file is saved with the .mov file extension and its URL is passed in the HREF parameter (with the TARGET parameter set to QuickTimePlayer). For details, see “QuickTime Media Links.”
One of the main reasons for launching QuickTime Player from a web page is to play a movie in full-screen mode. You can accomplish this in three different ways:
Create a QuickTime Media Link file that specifies one of the full-screen modes.
Create a movie with the full-screen attribute set internally, using an application such as LiveStage Pro, or Automator.
Add a sprite that sets the movie into full-screen mode at run time; such sprites can be authored in applications such as LiveStage and GoLive, and existing sprites can be added to a movie using most QuickTime editors, including QuickTime Player (Pro version).
You can use QuickTime to play media that are not formatted as QuickTime movie files. There are several ways to do this, all having one thing in common: they get the browser to load QuickTime, then tell QuickTime what media to play.
Use the <OBJECT> tag, with the ClassID attribute, to get Internet Explorer for Windows to load QuickTime. Include the <EMBED> tag, with the SRC parameter set to a QuickTime movie file, to get other browsers to load QuickTime. Pass the URL of the media you want QuickTime to play in the QTSRC parameter. An example is shown in listing 1-6
Listing 2-6 Playing non-QuickTime media using ClassID and QTSRC
<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" |
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" |
HEIGHT=yy |
WIDTH=xx |
> |
<PARAM NAME="src" VALUE="VerySmall.mov" > |
<PARAM NAME="QTSRC" VALUE="My.mp4" > |
<EMBED SRC="VerySmall.mov" |
HEIGHT=yy WIDTH=xx |
TYPE="video/quicktime" |
PLUGINSPAGE="http://www.apple.com/quicktime/download/" |
QTSRC="My.mp4" |
/> |
</OBJECT> |
-- or (the easy way) -- |
<script language="javascript"> |
QTWriteObject('VerySmall.mov', 'xx', 'yy', '', 'QTSRC', 'My.mp4'); |
</script> |
The movie whose URL is passed in the SRC parameter should be a very small file, but it should be a QuickTime movie. This file is used to cause the browser to load QuickTime; it is never displayed, but some browsers will download it, and the HTML will fail in some browsers if the file does not exist or is not a QuickTime movie.
The QTSRC parameter can specify any type of file or stream that QuickTime can play. QuickTime currently supports over 40 different media types and file formats transparently, including most common audio, video, and still image formats.
Important: If QTSRC is set to a relative URL, it must be relative to the movie specified in the SRC parameter, not the web page in which it is embedded.
Note: URLs cannot cross local/remote zone boundaries. In other words, a local movie (file:// protocol) can invoke only local URLs, such as another local movie, and remote movies (http://, https://, or rtsp:// protocol) can invoke only remote URLs, such as another remote movie or a web page. Furthermore, remote URLs are restricted to http://, https://, and rtsp:// protocols. Other protocols, such as javascript://, are prohibited.
A QuickTime Media Link is a small XML text file that tells QuickTime what media to play. It can be saved with the file extension .mov and treated for all intents and purposes as a QuickTime movie. This allows you to use a text file that appears to the browser as a QuickTime movie.
The easiest way to create such a file is to export a movie from QuickTime Player (Pro version) choosing Movie to QuickTime Media Link. This brings up a panel similar to the one shown in Figure 1-2 below.
The export creates a text file in XML format that QuickTime understands. You can also create this kind of file by hand. The syntax is shown in the following example:
<?xml version="1.0"?> |
<?quicktime type="application/x-quicktime-media-link"?> |
<embed |
autoplay="true" |
controller="false" |
fullscreen="full" |
href="http://www.apple.com/quicktime/" |
quitwhendone="true" |
src="http://myserver.com/path/My.mov" |
/> |
As you can see, the syntax is very similar to the <EMBED> tag syntax used in HTML. In addition to supporting many of the HTML parameters that the QuickTime plug-in understands, the XML file can specify a full-screen graphics mode and whether the QuickTime Player application should quit when the movie finishes. The following parameters and values are currently supported:
autoplay - true | false |
controller - true | false |
fullscreen - normal | double | half | current | full |
href - url |
kioskmode - true | false |
loop - true | false | palindrome |
movieid - integer |
moviename - string |
playeveryframe - true | false |
qtnext - url |
quitwhendone - true | false |
src - url (required) |
type - mime type |
volume - 0 (mute) - 100 (max) |
Note the following differences between XML and HTML versions of these parameters:
The qtnext attribute only supports one URL (unlike the plugin).
All specified attributes require values (AutoPlay=True is valid; AutoPlay alone is not).
You can embed the XML file in your web page as you would any QuickTime movie, using the <OBJECT> and <EMBED> tags. You can also pass it to QuickTime Player using the HREF and TARGET parameters (TARGET="QuickTimePlayer").
Important: If you create a QuickTime Media Link to be played in QuickTime Player, do not use a relative URL to specify the movie; use an absolute URL. The QuickTime Media Link may be passed to QuickTime Player from a cache, with no information about where it came from, therefore no starting point for a relative URL.
Note: URLs cannot cross local/remote zone boundaries. In other words, a local movie (file:// protocol) can invoke only local URLs, such as another local movie, and remote movies (http://, https://, or rtsp:// protocol) can invoke only remote URLs, such as another remote movie or a web page. Furthermore, remote URLs are restricted to http://, https://, and rtsp:// protocols. Other protocols, such as javascript://, are prohibited.
In addition to the preferred XML syntax described above, QuickTime supports a small assortment of text files that can masquerade as movies for the purposes of getting a browser to load QuickTime. The text files have an eight-character header, consisting of a four-character type followed by the four characters text. The header is case sensitive and must be typed exactly as shown. The header is followed by data of the type specified, such as an RTSP URL, a SMIL file, an SDP file, or a plain text file with optional QuickTime text descriptors.
In all cases, you create the text file by prepending the header string, followed by a space or carriage return, to a data file. You then change the file extension to .mov so web servers and browsers treat it as a QuickTime movie.
You can specify a streaming URL by creating a text file with the header RTSPtext followed by an RTSP URL. For example:
RTSPtext RTSP://Yourserver.com/StreamName |
You can save a SMIL file with the .mov file extension, if you preface the file with the text SMILtext. For example:
SMILtext |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
<!DOCTYPE smil PUBLIC "-//W3C//DTD SMIL 1.0//EN" |
"http://www.w3c.org/TR/REC-smil/SMIL10.dtd"> |
<smil xmlns:qt="http://www.apple.com/quicktime/resources/smilextensions" |
qt:time-slider="true" |
qt:autoplay="true" |
<head> |
<layout> |
<root-layout width="320" height="256" id="main" title="Movie Time"/> |
<region top="0" left="0" width="320" height="256" id="video" fit="meet"/> |
</layout> |
</head> |
<body> |
<seq > |
<video src="http://domain/path/filename" region="video" /> |
<video src="protocol://domain/path/filename" region="video" /> |
</seq> |
</body> |
</smil> |
Note that there must be a space or a line break between SMILtext and the rest of the SMIL document.
You can save an SDP (session description protocol) file with the .mov file extension, if you preface it with the text SDPtext. Note that the first character of the four-character type is an ASCII blank (hex 20). For example:
SDPtext |
v=0 |
o=- 42945 9 IN IP4 0.0.0.0 |
s=Title of the Session |
e=Session Contact <user@host.name> |
t=0 0 |
a=type:broadcast |
a=channel:Demo H.261 (Mbone) |
a=tool:Broadcaster Software |
a=cat:MBone/Others |
m=video 57170 RTP/AVP 31 32 96 |
c=IN IP4 0.0.0.0/0 |
b=AS:2500 |
a=framerate:30 |
a=rtpmap:96 WBIH/90000 |
a=source:video 0.0.0.0 file 1 loop |
m=audio 21116 RTP/AVP 0 |
c=IN IP4 0.0.0.0/0 |
b=AS:2500 |
a=source:audio 0.0.0.0 file 1 loop |
You can pass a text file with the .mov file extension to QuickTime—optionally including QuickTime text descriptors—to be imported into a movie with a text track, by beginning the file with the text TEXTtext followed by a space or carriage return and the text or text plus descriptors. For example:
TEXTtext |
{QTtext} {timeScale:30} {width:320} {height:240} {timeStamps:absolute} {language:1} {textEncoding:0} |
{font:helvetica} {size:12} {plain} {justify:center} {dropShadow:off} {anti-alias:on} |
{textColor: 65535, 65535, 65535} {backColor: 0, 0, 0} |
[00:00:00.00] |
{ScrollIn:on} |
Produced by Fate |
Directed by Chance |
Special Effects by Accident |
Any resemblance to actual people or events is beyond my ability. |
[00:00:10.00] |
Note: The text importer component is not currently part of the standard download for QuickTime, so not all users will be able to import the text without having to download a component from Apple. Import of text files at run time is most useful in a campus or corporate setting where the HTML author knows what QuickTime components are installed on end-user’s computers.
Last updated: 2007-06-06