Creating a SMIL file
SMIL is a simple but powerful XML compliant, mark-up language that coordinates when and how multimedia files play. A SMIL file (file extension .smi) can be created with any text editor or word processor than saves output as plain text with line breaks. An example of a simple SMIL file that lists multiple media files played in sequence is shown below.
Example 1:
<smil><!--The SMIL file must start with a <smil> tag and end with the </smil> closing tag.-->
<head> <!-- SMIL file header, specify meta information in the multimedia presentation-->
<meta name="author" content="Jane Morales"/>
<meta name="title" content="Multimedia My Way"/>
<meta name="copyright" content="(c)1998 Jane Morales"/>
</head>
<body>
<seq> <!-- To play clips in sequence, use the <seq> ("sequence") SMIL tag.-->
<audio src="audio/newsong.wav"/>
<audio src="audio/oldsong.snd"/>
</seq>
</body>
</smil>
Example 2:
<smil> <!--The SMIL file must start with a <smil> tag and end with the </smil> closing tag.-->
<head>
<meta name="author" content="Jane Morales"/>
<meta name="title" content="Multimedia My Way"/>
<meta name="copyright" content="(c)1998 Jane Morales"/>
</head>
<body>
<par> <!-- To play clips simultaneously, use the <par> ("parallel") SMIL tag1.-->
<audio src="song1.snd" clip-begin="30.4s" clip-end="60.4s"/>
<audio src="song2.ra" delay="28s" clip_begin="2.4s" clip-end="13.7s">
<!-- To specify clip start and delay, use the <clip-begin and clip-end> SMIL tag.-->
</par>
</body>
</smil>
1The timing options modify the <par> tag so that the two clips start at different times. The first clip begins to play immediately, but starts at 30.4 seconds into its timeline. Because it ends at 60.4 seconds into its timeline, this clip plays for exactly 30 seconds. The second clip is delayed for 28 seconds. That means it overlaps the first clip by 2 seconds. It starts at 2.4 seconds into its timeline and ends at 13.7 seconds into its timeline, thus playing for 11.3 seconds. The total length of this group presentation is 30 seconds for the first clip, plus 11.3 seconds for the second clip, minus the 2 second overlap: 39.3 seconds.
Example 3:
<smil> <!--The SMIL file must start with a <smil> tag and end with the </smil> closing tag.-->
<head>
<meta name="author" content="Jane Morales"/>
<meta name="title" content="Multimedia My Way"/>
<meta name="copyright" content="(c)1998 Jane Morales"/>
</head>
<body>
<seq> <!-- You can nest <seq> and <par> tags2.-->
file 1
<par>
file 2
file 3
</par>
file 4
</seq>
</body>
</smil>
2In the example above, file 1 plays first. When file 1 finishes, file 2 and file
3 play together. When both file 2 and file 3 have finished, file 4 plays. Very different results, though,
occur if the <seq> and <par> groupings are switched.
Example 4:
<smil> <!--The SMIL file must start with a <smil> tag and end with the </smil> closing tag.-->
<head>
<meta name="author" content="Jane Morales"/>
<meta name="title" content="Multimedia My Way"/>
<meta name="copyright" content="(c)1998 Jane Morales"/>
</head>
<body>
<switch>
<!--The <switch> SMIL tag can be used to define the choices client can make based on its available bandwidth-->
<par system-bitrate="75000">
<!--for dual isdn and faster-->
<audio src="audio/newsong1.snd"/>
<video src="video/newsong1.avi"/>
<image src="lyrics/newsong1.gif"/>
</par>
<par system-bitrate="47000">
<!--for single isdn-->
<audio src="audio/newsong2.snd"/>
<video src="video/newsong2.avi"/>
<image src="lyrics/newsong2.gif"/>
</par>
<par system-bitrate="28000">
<!--for 28.8kpbs modem-->
<audio src="audio/newsong3.snd"/>
<video src="video/newsong3.avi"/>
<image src="lyrics/newsong3.gif"/>
</par>
</switch>
</body>
</smil>