Recipe 17.6 Embedding a QuickTime Movie in a JSP


You want to embed a QuickTime movie in your JSP.


Use the embed tag nested inside the object tag. The object tag has to contain the CLASSID attribute with the proper value.


Similar to using the Java Plug-in, a JSP uses the embed tag inside of an HTML object tag to properly load one of Apple Computer's QuickTime movies. You must include the CLASSID attribute value exactly as Example 17-9 specifies. You also must include the same CODEBASE attribute value. If the user has an Internet Explorer Windows browser, but has not yet installed the QuickTime ActiveX control, the CODEBASE attribute value specifies where the user can download it.

Example 17-9. Embedding a QuickTime movie in a JSP
 <%@ taglib uri="" prefix="c" %> <jsp:useBean id="date" class="java.util.Date" /> <html> <head><title>QuickTime in a JSP</title></head> <body> <h2>Ladies and Gentlemen, The Who</h2>  <OBJECT CLASSID=     "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="320"     HEIGHT="256" CODEBASE=""> <PARAM name="SRC" VALUE=""> <PARAM name="AUTOPLAY" VALUE="true"> <PARAM name="CONTROLLER" VALUE="true"> <EMBED src=""      WIDTH="240" HEIGHT="196"      AUTOPLAY="true" CONTROLLER=     "true" PLUGINSPAGE=""> </EMBED> </OBJECT>  <br /><c:out value="${date}"/> </body> </html> 

If the browser uses Netscape-style plug-ins, then the embed tag will initiate the loading of the QuickTime movie. The JSP in Example 17-6 properly loaded the movie into the Safari web browser on my Macintosh laptop, for instance. One of the advantages of the embed tag is that you can use a number of proprietary attributes that the embedded object, such as QuickTime, understands. Example 17-9 specifies that the movie should start playing as soon as the browser has loaded enough data ( AUTOPLAY="true ") as well as that the browser should show the movie controls, which lets the user stop or start the movie ( CONTROLLER="true ").

Figure 17-4 shows the QuickTime movie embedded in the JSP of Example 17-9.

Figure 17-4. A QuickTime movie embedded in a JSP

See Also

Apple Computer's guide on embedding QuickTime in Web pages:; Recipe 17.3-Recipe 17.5 on embedding a Flash file; Recipe 17.7 on embedding an SVG file in a JSP; Recipe 17.8 on embedding a background soundtrack.

Java Servlet & JSP Cookbook
Java Servlet & JSP Cookbook
ISBN: 0596005725
EAN: 2147483647
Year: 2004
Pages: 326 © 2008-2017.
If you may any questions please contact us: