<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="None">
  <name>Multimedia Example</name>
  <metadata>
  <md:version>1.1</md:version>
  <md:created>2007/09/28 12:51:47.675 GMT-5</md:created>
  <md:revised>2007/09/28 18:41:10.145 GMT-5</md:revised>
  <md:authorlist>
      <md:author id="hungtran">
      <md:firstname>Tran</md:firstname>
      <md:othername>Viet</md:othername>
      <md:surname>Hung</md:surname>
      <md:email>hungtran@vef.gov</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="hungtran">
      <md:firstname>Tran</md:firstname>
      <md:othername>Viet</md:othername>
      <md:surname>Hung</md:surname>
      <md:email>hungtran@vef.gov</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>Multimedia</md:keyword>
  </md:keywordlist>

  <md:abstract>This is to demonstrate multimedia content in Vietnam OpenCourseWare. Multimedia content is collected from Connexions project at: http://cnx.org</md:abstract>
</metadata>

  <content>
    <section id="intro">
      <name>Introduction</name>
      <para id="intropara1">
	Connexions modules can contain many different types of
	multimedia. This document explains how you can add the
	following types of multimedia objects to a module:
	<list id="l1">
	  <item><cnxn target="images">Images</cnxn></item>
	  <item><cnxn target="flash">Flash objects</cnxn></item>
	  <item><cnxn target="movies">Movies</cnxn></item>
	  <item><cnxn target="java">Java applets</cnxn></item>
	  <item><cnxn target="audiofiles">Audio files</cnxn>  </item>
	  <item><cnxn target="labview">LabVIEW demonstrations</cnxn></item>
	</list>
      </para>
      <para id="intropara2">
	Any type of multimedia object that can be embedded in a Web
	page can be put into a Connexions module using the CNXML
	<code>media</code> tag. See the description of the <link src="http://cnx.rice.edu/technology/cnxml/0.5/spec/#media">media</link>
	tag in the <cite>CNXML Language Specification</cite> for more
	information. The only requirement is that the object must have
	a valid MIME (Multipurpose Internet Mail Extension) type. MIME
	is a protocol that enables the transmission of data, such as
	sound or movies, over the Internet without first having to be
	translated into an ASCII format.  See <link src="http://www.ietf.org/rfc/rfc1341.txt?number=1341">MIME
	Types</link> for more information. This module contains
	examples of the CNXML entries and their resulting displays for
	the different multimedia objects.
      </para>
      
    <section id="importnotes">
       <name>Important Notes on Multimedia Additions</name>
       	<para id="importpara1">
       	  Please note the following items when you are working with multimedia
       	  additions to your module:
       	  <list id="importlist">
       	  <item>
	      The CNXML examples shown in this module are specific to
       	  the media displays in this module. If you copy them into
       	  your module, please edit the CNXML for your
       	  situation.</item> <!-- <item>All material within Connexions
       	  is licensed under the <link
       	  src="http://creativecommons.org/licenses/by/2.0/">Creative
       	  Commons Attribution license</link>. Any multimedia objects
       	  you add to your module must be in the public domain or under
       	  the Creative Commons Attribution license.</item> -->
       	  <item>
	      The <code>type</code> attribute must match the MIME type
	  for the media object you want to appear in the module. For
	  example, if you are adding an image file that is in the
	  Portable Networks Graphics (png file extension) format, the
	  type attribute must be <code>image/png</code>.  The entry
	  would look like the following example:
	  	<code type="block">
	  	 <![CDATA[
	  	    <media type="image/png" src="mypicture.png"/>
	  	]]>
	  	</code>
	  </item>
	  <item>
	      You can use any type of media object as long as it has a
	  valid MIME type.</item> <item>If you need assistance adding
	  a multimedia object, or you have questions about an object
	  not listed in this module, please contact Connexions
	  technical support at <link src="mailto:techsupport@cnx.rice.edu">techsupport@cnx.rice.edu</link>.
       	  </item>
       	  <item>
	      You can pass controlling options or parameters to the
       	  multimedia objects with the <cnxn target="paramsect">param</cnxn> tag.</item>
       	  </list>
	</para>
      </section>
    </section>
    
    <section id="images">
      <name>Images</name>
      <para id="imagepara1">
	Some of the image file types and their corresponding MIME types used 
	in Connexions modules are:
	<list id="l4">
	  <item>eps - media type="application/postscript"</item>
	  <item>png - media type="image/png" </item>
	  <item>jpeg - media type="image/jpeg"</item>
	  <item>gif - media type="image/gif"</item>
	</list>
	This list is not all inclusive. Any image with a valid 
	<link src="http://www.duke.edu/websrv/file-extensions.html">MIME type</link> 
	can be used in a module.
      </para>
      <para id="imagepara2">
	To embed images in your module, insert CNXML entries similar to the 
	following example into the "index.cnxml" file for your module:
	<code type="block">
	 <![CDATA[
	  <figure id="figure-01">
	    <name>Example Figure</name>
	    <media type="image/png" src="envelope-taller.png"/>
	    <caption>A graphic image displayed as a figure.</caption>
	  </figure> 
	]]>
	</code>
      </para>
      
      <para id="imagepara3">
	The <code>src</code> attribute in the media tag gives the location 
	or source of the image that you want to appear in the module. The 
	attribute can be a file name if you have uploaded the file into your 
	module, or a full URL for an image file stored elsewhere on the 
	Internet. 
      </para>
      
      <para id="imagepara3a">
	The <cnxn target="figure-01">actual display</cnxn> for the previous 
	CNXML example is:
	 <figure id="figure-01"><name>Example figure</name>
	  <media type="image/png" src="Xenvelope-blue-on-blue.png"/>
	  <caption>A graphic image displayed as a figure.</caption>
	</figure>
       </para>
       
       <para id="imagepara4">
	You can place two images within the same figure using the 
	<code>subfigure tag</code>. This is useful when you have two 
	related images that you want to display side-by-side or one
	above the other. To display two images within the same figure, 
	insert CNXML entries similar to the following example into the 
	"index.cnxml" file for your module:
	<code type="block">
	 <![CDATA[
     <figure id="figure-2" orient="horizontal">
        <subfigure id="subfigure-1">
          <name>Tall Icon and Envelope</name>
          <media type="image/png" src="envelope-taller.png"/>
          <caption>
          Subfigure 1.
          </caption>
        </subfigure>
        <subfigure id="subfigure-2">
          <name>Small Icon and Envelope</name>
          <media type="image/png" src="envelope.png"/>
          <caption>
            Subfigure 2.            
          </caption>
        </subfigure>
 	<caption>Two images displayed horizontally in one figure.</caption>
     </figure>
	  ]]>
	</code>
      </para>
      
      <para id="imagepara5">The <cnxn target="figure-2">actual display</cnxn> for the previous 
	CNXML example is:
	<figure id="figure-2" orient="horizontal"><subfigure id="subfigure-1">
          <name>Blue on blue</name>
          <media type="image/png" src="Xenvelope-blue-on-blue.png"/>
          <caption>
          Subfigure 1.
          </caption>
        </subfigure>
        <subfigure id="subfigure-2">
          <name>Orange on white</name>
          <media type="image/png" src="Xenvelope.png"/>
          <caption>
            Subfigure 2.            
          </caption>
	  </subfigure>
	  <caption>Two images displayed horizontally in one figure.</caption>
	</figure>
      </para>
      
      <para id="imagepara6">
	The attribute <code>orient</code> can have a value of 
	<code>horizontal</code> or <code>vertical</code>, and determines 
	how the images are arranged in the figure.
      </para>

      <section id="print">
	<name>Including Images for Both On-Line and Print Versions of Your Module</name>
	<para id="printp">
	  If the images in your module are the appropriate size when you 
	  view them on-line, but when you print the module they appear too 
	  large for the page, Connexions lets you insert an additional 
	  image file in your module that can be formatted and sized 
	  specifically for the print version. Image files formatted in 
	  <code>eps</code> are the preferred format for printed versions 
	  of Connexions modules. If your module contains <code>eps</code> 
	  files and <code>png</code> files of the same image, Connexions 
	  uses the <code>eps</code> files when it generates a PDF file 
	  for printing and uses the <code>png</code> files when displaying 
	  the module on-line. 
	</para>  
	<para id="printp2">  
	  Here is how to insert additional image files in your module 
	  for the print version:
	  <list id="printlist" type="enumerated">
	    <item>Create an <code>eps</code> format version of your 
	    image files. The image should be sized to the appropriate 
	    dimensions.</item>
	    <item>Insert a <code>media type</code> entry for the 
	    <code>eps</code> image file in the "index.cnxml" file just 
	    above the entry for image file for the on-line display. The 
	    image files should have the same name, except that the 
	    extension should indicate the file type. For example: 
	    "image1.png"  (for on-line) and "image1.eps" (for print)</item>
    	    <item>Add the <code>eps</code> image file to the module.</item>
	  </list>
	  Here is an example of the CNXML code required to include additional 
	  images:
	  <code type="block">
	   <![CDATA[
	    <figure id='printimage'>
	     <media type='application/postscript' src='image.eps'>
	      <media type='image/png' src='image.png'/>
             </media>
            </figure>
	    ]]>
	  </code>
	  <note>
	  The print image (<code>eps</code>) entry must appear above the 
	  on-line image (<code>png</code>) entry in the "index.cnxml" file. 
	  The on-line image entry should be indented and nested under the 
	  alternate image entry. 
	  </note>
	</para>
      </section>
      
      <section id="clickable">
	<name>Creating an Image with a Link to a Larger Version</name>
	<para id="linked">
	  You can also display an image, that when clicked, displays a 
	  larger version of the image. Here is how to do it:
	  <list id="tlist" type="enumerated">
	    <item>Create a thumbnail-sized version of your image file.</item>
	    <item>Insert a <code>media type</code> entry for the full-sized
	    and thumbnail images, as shown in the following example.</item>
	    <item>Add the full-sized and thumbnail image files to the module.
	    </item>
	  </list>
	  Here is an example of the CNXML code required to include a thumbnail 
	  image that links to a full size version:
	  <code type="block">
	   <![CDATA[
	    <figure id='thumbnail'>
	     <media type='image/png' src='TajMahal_medium.jpg'>
	      <param name='thumbnail' value='TajMahal_Thumb.jpg'/>
             </media>
            </figure>
	    ]]>
	  </code>
	The <cnxn target="thumbnail">actual display</cnxn> for the previous 
	CNXML example is:
	   <figure id="thumbnail"><media type="image/jpeg" src="TajMahal_medium.jpg">
	      <param name="thumbnail" value="TajMahal_Thumb.jpg"/>
	    </media>
	    <caption>The photograph of the Taj Mahal in this figure and the following figures was taken by <link src="http://www.flickr.com/photos/babasteve/">Steve
	  Evans</link>.  It is licensed for public use under the
	  Creative Commons Attribution License.</caption>
	  </figure>
	</para>
      </section>
      <section id="resize_images">
        <name>Adjusting the Size of the Image in the On-Line Version</name>
        <para id="add_param">You can also adjust the size of the image in the on-line version of your document by using <code>param</code> tags with <code>name</code> attributes for <code>height</code> and <code>width</code>.
        </para><para id="element-702">Here is an example of the CNXML code required to adjust the size of the on-line version of an image:
<code type="block"><![CDATA[<figure id="element-856">
  <media type="image/jpeg" src="TajMahal_medium.jpg">
    <param name="height" value="250"/>
    <param name="width" value="250"/>
  </media>
</figure>]]></code>
The way this code would display is shown in <cnxn target="element-856"/>.</para><figure id="element-856"><media type="image/jpeg" src="TajMahal_medium.jpg">
    <param name="height" value="250"/>
    <param name="width" value="250"/>
  </media></figure><para id="element-568">The original figure is shown in <cnxn target="element-439"/>.</para><figure id="element-439"><media type="image/jpeg" src="TajMahal_medium.jpg"/></figure>
      </section>
    </section>

    <section id="flash">
      <name>Flash Objects</name>
      <para id="flpara">
	You can insert Flash objects in your module. Here is an example of 
	the CNXML code required to include a Flash object:
	<code type="block">
	 <![CDATA[
         <figure id='flashfig'>
	  <media type="application/x-shockwave-flash" src="flash.swf">
	    <param name='height' value='250'/>
            <param name='width'  value='250'/>
          </media>
	  <caption>"Welcome to Connexions" example Flash object.</caption>
         </figure>
	  ]]>
	</code>
	The <cnxn target="flashfig">Flash object</cnxn> appears in your 
	module, similar to the way in which a movie or an image appears. 
          <figure id="flashfig">
 	  <media type="application/x-shockwave-flash" src="flash2.swf">
 	    <param name="height" value="250"/>
            <param name="width" value="250"/>
          </media>
	  <caption>"Welcome to Connexions" example Flash object.</caption>
          </figure>
      </para>
	<note>The example above is enclosed within <code>figure</code> tags 
	to allow captions for explanation purposes. The <code>figure</code> 
	tags are not required to include these media objects in a module.</note>
    </section>

    <section id="movies">
      <name>Movies</name>
      <para id="movieslist">
	The following is a list of some types of movies that you can 
	include in your module. You can embed these types and any other 
	type that can normally be inserted into a web page.
      <list id="l2">
	<item>quicktime</item>
	<item>mpeg</item>
      </list>
      </para>
      <para id="moviep">
	Movies can be added to your module by including code similar 
	to the following:
	<code type="block">
	 <![CDATA[
	<figure id='moviefig2'>
	  <media type="video/mpeg" src="Building_on_the_Past.mpg">
	    <param name="width" value="450"/>
	    <param name="height" value="400"/>
	    <param name="autoplay" value="false"/>
	  </media>
	  <caption>The Creative Commons movie: "Building on the Past". 
	 Click the Play button to start the movie.</caption>
	</figure>
	  ]]>	  
	</code>
	The <cnxn target="moviefig2">actual display</cnxn> for the previous 
	CNXML example is:
	<figure id="moviefig2">
	  <media type="video/mpeg" src="Building_on_the_Past.mpg">
	    <param name="width" value="450"/>
	    <param name="height" value="400"/>
	    <param name="autoplay" value="false"/>
	  </media>
	  <caption>The Creative Commons movie: "Building on the Past". 
	    Click the Play button to start the movie.</caption>
	</figure>
      </para>
	<note>The example above is enclosed within <code>figure</code> tags 
	to allow captions for explanation purposes. The <code>figure</code> 
	tags are not required to include these media objects in a module.</note>
    </section>

    <section id="java">
      <name>Java Applets</name>
      <para id="javap">
	Java applets can be added to your module by including code similar 
	to the following:
	<code type="block">
	 <![CDATA[
	<figure id="javafig">
          <media type="application/x-java-applet" src="PhasorDemo.class">
            <param name="width" value="430"/>
            <param name="height" value="500"/>
	  </media>
          <caption>3D Animation of a Complex Sinusoid. Click the Run button 
           to start the animation.</caption>
        </figure>
	  ]]>
	</code>
	The <cnxn target="javafig">actual display</cnxn> for the previous 
	CNXML example is:
	<figure id="javafig">
	  <media type="application/x-java-applet" src="PhasorDemo.class">
	    <param name="width" value="430"/>
	    <param name="height" value="500"/>
	  </media>
	  <caption>3D Animation of a Complex Sinusoid. Click the Run button 
	    to start the animation.</caption>
        </figure>
        If the graphic does not appear in the figure above, you may 
        need to install or upgrade the Java plug-in on your computer. Please 
        go to <link src="http://java.com">java.com</link> to download the 
        latest version of the Java plug-in.
      </para>
	<note>The example above is enclosed within <code>figure</code> tags 
	to allow captions for explanation purposes. The <code>figure</code> 
	tags are not required to include these media objects in a module.</note>
    </section>

    <section id="audiofiles">
      <name>Audio Files</name>
      <para id="audiop">
	Audio files such as mp3, real audio, and wav files can be inserted 
	into your module quickly and easily. To include audio files in your 
	document, upload the corresponding audio file and include code similar 
	to the following in your "index.cnxml" document:
	<code type="block">
	 <![CDATA[
      	 <figure id='musicscale'>
      	  <media type="audio/x-wav" src="chromatic_slurred.wav"/>
      	  <caption>A chromatic scale performed on clarinet by Michael Lawrence.</caption>
         </figure>
	  ]]>
	</code>	  
      </para>
      <para id="parascale">
	The <cnxn target="musicscale">actual display</cnxn> for the previous 
	CNXML example is:
      	 <figure id="musicscale">
      	  <media type="audio/x-wav" src="chromatic_slurred.wav"/>
	  <caption>A chromatic scale performed on clarinet by Michael Lawrence.</caption>
         </figure>
      </para>
	<note>The example above is enclosed within <code>figure</code> tags 
	to allow captions for explanation purposes. The <code>figure</code> 
	tags are not required to include these media objects in a module.</note>
    </section>

    <section id="labview">
      <name>LabVIEW Demonstrations</name>
      <para id="labviewp">
	For information on including LabVIEW demonstrations in your 
	module, please see 
	<cnxn document="m11601">Creating LabVIEW demonstrations for Connexions</cnxn>.
      </para>
    </section>
    
    <section id="paramsect">
      <name>Media Type Parameters</name>
      <para id="parampara1">
	Some multimedia objects need options or parameters to display 
	properly. You can pass this information to the multimedia objects 
	with the <code>param</code> tag. This tag is contained within the 
	<code>media</code> tags and does not require modification of the 
	<code>media</code> tag. See the description of the 
	<link src="http://cnx.rice.edu/technology/cnxml/0.5/spec/#param">param</link>
	tag in the <emphasis>CNXML Language Specification</emphasis> for more 
	information.  
      </para>
      
      <para id="parampara2">
        Here is an example of a <code>param</code> tag entry for a video 
        (mpg) object:  
      	<code type="block">
      	 <![CDATA[
      	 <media type="video/mpeg" src="testmovie.mpg">
       	   <param name="width" value="300"/>
      	   <param name="height" value="300"/>
      	 </media>
      	  ]]>	  
      	</code>
      	<note>
      	You should include the height and width parameters for any 
      	movie, Flash object, or Java applet that needs to display on-line
      	in a specific size. The default units of height and width are 
      	pixels. In the previous example, the movie displays as a 
      	300 pixel by 300 pixel box.
      	</note>
      </para>
      
      <para id="parampara3">
      Different multimedia object types support and respond to different 
      parameters. Examples of some of the parameters for the different 
      multimedia object types are:
      <list id="paramlist">
      <item>Images (image/*): height, width, title, alt</item>
      <item>Flash (application/x-shockwave-flash): height, width, base</item>
      <item>Video (video/*): height, width, classid, codebase, autostart</item>
      <item>Java Applets (application/x-java-applet): height, width, 
      code, codebase, archive</item>
      <item>Audio (audio/*): title, volume</item>
      <item>LabVIEW (application/x-labview): viinfo 
      (See <cnxn document="m11601">Creating LabVIEW demonstrations for Connexions</cnxn> 
      for more information.)</item>
      </list>
      <note>
      The <code>param</code> tag allows you to specify the run-time 
      settings for an object inserted into XHTML documents.
      </note>
      </para>
      
      <section id="paramsect2">
	<name>Params and Alternate Images</name>
      <para id="parampara4">
        If you are using nested media tags to provide for an alternate image 
        display, such as a photograph that appears in the printed version 
        of the module to replace a movie that appears in the on-line version, 
        insert the <code>param</code> entries for the primary image before 
        the nested <code>media</code> entry for the alternate image, as 
        shown in the following example:
      	<code type="block">
      	 <![CDATA[
         <media type="video/mov" src="howto.mov">
           <param name="height" value="250" />
           <param name="width" value="250" />
           <media type="image/png" src="novideo.png />
         </media> 
      	  ]]>	  
      	</code>
      </para>
      </section>
    </section>
    
  </content>
  
</document>
