Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Getting a Browser to Load QuickTime

QuickTime includes plug-ins for browsers in various formats, including Netscape-style plug-ins, ActiveX controls, and Safari plug-ins. These plug-ins allow you to display QuickTime-compatible content in a browser window, or to launch the QuickTime Player application from a web page. These plug-ins are installed automatically when QuickTime is installed.

There are three tags that can be used to open QuickTime-compatible content in a browser window:

Direct download of QuickTime content should generally be avoided. QuickTime content should be embedded in a web page using either the <EMBED> tag alone or the <EMBED> and <OBJECT> tags together. The reasons for this are explained in the following sections, “Using the <A> Tag (Direct Download),” and “Using the <EMBED> and <OBJECT> Tags.”

In this section:

Using the <A> Tag (Direct Download)
Using the <EMBED> and <OBJECT> Tags


Using the <A> Tag (Direct Download)

The easiest and most common way to tell a browser to load content is to link to a URL using the <A> tag, as shown in this example:

<A HREF=url> Link Text </A>

When the user clicks on the link text, the browser loads the specified URL.

Equivalent ways to directly open content in a browser include using JavaScript to open or replace a window (passing the URL of the content as the SRC parameter for the window), or opening a frameset and passing the URL of the content as the SRC parameter for a frame.

All of these methods specify the URL of the content and tell the browser to open the file in a window or frame, leaving the manner of display entirely to the browser. This is fine when the content is an HTML page, but problematic for multimedia content such as QuickTime movies.

If the URL points to something the browser can display, such as a JPEG or another HTML page, the browser loads and displays it. If the URL points to something the browser needs help to display, such as a QuickTime movie, MP3 audio, or MPEG-4 video file, the browser checks a list of plug-ins or applications that are registered for that type of file; if it finds a plug-in, it loads the plug-in and passes either the file or the URL; if it finds only an application, it may launch the application and pass it the file, ask the user for permission to do so, or simply download the file to disk for the user to open later, depending on the browser type and user settings.

There are several reasons why you should not use the <A> tag, JavaScript, or a frameset to link directly to the URL of QuickTime content:

  1. You cannot specify what plug-in or application should be used. If more than one plug-in is registered for the specified file type, you cannot predict or control which is loaded.

  2. If QuickTime is not installed, the user is not prompted to download it. The browser simply reports that it cannot display file X because it is an unsupported type.

  3. The <A> tag does not allow you to pass parameters to a plug-in, so you cannot control QuickTime using this tag, even if the browser chooses to display the content using QuickTime.

  4. Many browsers download the entire file specified by the URL before invoking a plug-in, which prevents the movie from playing as it downloads (known as Fast Start or progressive download).

  5. The <A> tag loads the specified URL in its own window or frame; you cannot surround the displayed media with text or images in the same window or frame.

We recommend that you do not use the <A> tag to play QuickTime content. Use the <EMBED> and <OBJECT> tags instead. If you chose to use the <A> tag to display QuickTime content, follow these guidelines for best results:

  1. Use only QuickTime-specific media files, such as QuickTime movies (.mov) or QuickTime image files (.qtif). Other media types are less likely to be registered exclusively by QuickTime.

    If you wish to use QuickTime to play other file types, such as MP3 audio (.mp3) or MPEG-4 video (.mp4), open the files in QuickTime Player Pro or some other QuickTime editor and save them as QuickTime movie files, then link to the movie files.

  2. Always save QuickTime movies with the .mov file extension.

  3. Be sure that your web server is configured with the .mov file extension corresponding the the MIME type video/quicktime.

  4. Include a notice on your web page that QuickTime is needed to view the specified content; include a link to the QuickTime download site (www.apple.com/quicktime/download/), and inform your viewers that it is a free download.

    For a free “Get QuickTime -- Free Download” GIF and usage guidelines, see www.apple.com/about/webbadges/.


Figure 2-1  Get QuickTime

Get QuickTime

Note: You can save movie files either allowing dependencies or as self-contained movies. If you allow dependencies, the movie files are very small and depend on the original media files; you must keep the movie files and media files together on the server or the movies do not play. If you create self-contained movie files, the movie files are larger but they do not depend on external files; you can transfer them to a server without the original media files and they will still play over the Internet.

Using the <EMBED> and <OBJECT> Tags

The best way to get a browser to load and pass parameters to QuickTime is to use a combination of the <EMBED> tag and the <OBJECT> tag. By using both tags, you can write HTML that is optimized for all browsers and provides the most consistent user experience on Windows and the Mac OS, whether using Internet Explorer, FireFox, Safari, AOL, or other browsers.

You can use either the <EMBED> tag or the <OBJECT> tag alone, but Internet Explorer for Windows behaves differently from other browsers in both cases, so the user experience will be inconsistent, depending on the browser and operating system.

Using both tags allows you to specify the URL of the media file to play, the file’s MIME type, the QuickTime ActiveX control for Windows, where to get QuickTime if it is not installed, and the area on the web page to allot to the plug-in. This allows you to embed multimedia content anywhere in a page and to design the page accordingly.

<EMBED> Tag Syntax

This example shows the basic syntax for for embedding a QuickTime movie in a web page:

<EMBED
SRC="MyMovie.mov"
HEIGHT=yy WIDTH=xx
TYPE="video/quicktime"
PLUGINSPAGE="http://www.apple.com/quicktime/download/"
/>

The SRC parameter is set to the movie’s URL. In the example above, the movie is in the same folder as the HTML page, so the relative URL is simply the filename of the movie.

WIDTH should be set to the movie width. For an audio movie with a control bar, WIDTH should be set to an aesthetically pleasing size for your web page. A width of at least 150 pixels is recommended to allow the user to scrub through the movie by dragging the play head.

HEIGHT should be set to the movie height plus 16 pixels, assuming the movie control bar is displayed. An audio movie should have a height of 16, which is the height of the controller.

TYPE should be set to the QuickTime movie MIME type: video/quicktime.

PLUGINSPAGE should always be set the the download page for QuickTime: http://www.apple.com/quicktime/download/.

The preceding example should cause the browser to load the QuickTime plug-in, begin downloading the movie file, and pass the incoming data to QuickTime. If the <EMBED> tag contains additional parameters, their names and values are also passed to the QuickTime plug-in.

If the user’s computer does not have QuickTime installed, the browser should offer to get the necessary plug-in from Apple using the PLUGINSPAGE URL.

There is one notable exception to this standard behavior. Internet Explorer for Windows no longer supports the PLUGINSPAGE attribute for the <EMBED> tag. If the user does not have QuickTime installed, Internet Explorer for Windows will not offer to get it unless the <OBJECT> tag is used. If QuickTime is installed, however, the <EMBED> tag works consistently in all common browsers.

Important: The web browser chooses a plug-in based on the MIME type of the file specified in the URL. For this to work reliably, the URL must specify a QuickTime movie using the .mov file extension, and the web server must be configured with the file extension .mov associated with the MIME type video/quicktime.

<OBJECT> Tag Syntax

Here is the basic syntax for embedding a QuickTime movie in a web page using the <OBJECT> tag, intended for use by Internet Explorer for Windows:

<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" >
 
</OBJECT>

CLASSID is set to the Microsoft-authorized ID for the QuickTime ActiveX control: clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B. This causes Internet Explorer to load the QuickTime ActiveX control if it is installed, regardless of the media file type.

CODEBASE is set the URL for the QuickTime ActiveX control: http://www.apple.com/qtactivex/qtplugin.cab. If QuickTime is not installed on the user’s system, Internet Explorer offers to download it from this address.

WIDTH should be set to the movie width. For an audio movie with a control bar, WIDTH should be set to an aesthetically pleasing size for your web page. A width of at least 150 pixels is recommended to allow the user to scrub through the movie by dragging the play head.

HEIGHT should be set to the movie height plus 16 pixels, assuming the movie control bar is displayed. An audio movie should have a height of 16, which is the height of the controller.

The URL of the QuickTime movie is passed as the value of a <PARAM> element whose name is set to src. The example shows a relative URL to a movie file in the same folder as the surrounding web page.

The preceding example should cause Internet Explorer for Windows to load the QuickTime AciveX control, begin downloading the movie file, and pass the incoming data to QuickTime. If the <OBJECT> tagset contains additional <PARAM> elements, their names and values are also passed to QuickTime.

Important: This HTML works only with Internet Explorer for Windows. All other browsers, including Internet Explorer for Macintosh, ignore <OBJECT> tags that contain a CODEBASE or CLASSID attribute. For HTML that works consistently with Internet Explorer for Windows as well as other browsers, use both the <OBJECT> tag and the <EMBED> tag, as described in the following section.

Combined <EMBED> Tag and <OBJECT> Tag Syntax

Here is the basic syntax for embedding a QuickTime movie in a web page by combining the <EMBED> and <OBJECT> tags. This is the recommended syntax for using QuickTime in a 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="MyMovie.mov" >
 
<EMBED
SRC="MyMovie.mov"
HEIGHT=yy WIDTH=xx
TYPE="video/quicktime"
PLUGINSPAGE="http://www.apple.com/quicktime/download/"
/>
 
</OBJECT>

As you can see, the <EMBED> tag is simply nested inside the <OBJECT> tagset, after all <PARAM> elements and before the closing </OBJECT> tag.

Important: When using the <EMBED> tag alone, it is common practice to close the tag with a simple angle bracket (>). When used inside the <OBJECT> tagset, however, the <EMBED> tag must be formally closed, either with a forward-slash angle bracket (<EMBED.../>) or with a simple angle bracket followed by a separate “close” tag (<EMBED...></EMBED>).

The preceding HTML example causes Internet Explorer for Windows to load the QuickTime ActiveX control based on the value of CLASSID, or offer to download it from the URL specified in CODEBASE if the QuickTime ActiveX control is not already installed.

Browsers other than IE/Win ignore the <OBJECT> tag and its <PARAM> elements because they do not support the CLASSID or CODEBASE attributes; instead they interpret the <EMBED> tag within the <OBJECT> tagset. They load the QuickTime plug-in or ActiveX control based on the MIME type (video/quicktime) associated with the file extension (.mov) specified in the SRC parameter URL. If QuickTime is not installed, these browsers offer to download the QuickTime plug-in from the URL specified in the PLUGINSPAGE parameter.

All browsers use their respective HEIGHT and WIDTH parameters to reserve screen space for the movie and pass any other parameters to QuickTime.

Any additional parameters should be included in both the <EMBED> and <OBJECT> tags, using slightly different syntax. Parameters are passed in the <EMBED> tag using the syntax ParamName="ParmValue". Parameters are passed in the <OBJECT> tagset as separate <PARAM> tags, using the syntax <PARAM name="ParamName" value="ParamValue">. For example:

<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
HEIGHT=yy
WIDTH=xx
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab"
>
 
<PARAM NAME="src" VALUE="MyMovie.mov" >
<PARAM NAME="autoplay" VALUE="true" >
 
<EMBED
HEIGHT=yy
WIDTH=xx
TYPE="video/quicktime"
PLUGINSPAGE="http://www.apple.com/quicktime/download/"
SRC="MyMovie.mov"
AUTOPLAY="true"
/>
 
</OBJECT>

This example sets the attribute named AUTOPLAY to the value true for both the <EMBED> tag and the <OBJECT> tagset.

Note: You don’t have to code the <OBJECT> and <EMBED> tags by hand. See “Doing It the Easy Way.”



< Previous PageNext Page > Hide TOC


Last updated: 2007-06-06




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice