|
A WebDeveloper.com Feature
|
Not All SMILs
Part 2
By Nate Zelnick
Let’s take a simple presentation that consists of a set of static pictures that are displayed at certain time triggers while an audio track plays.
<smil>
<head>
<layout>
<region id="audio" left="0" top="0" height="1" width="1" z-index="1"/>
<region id="image" left="0" top="0" height="350" width="400" z-index="2"/>
</layout>
</head>
<body>
<par>
<audio id="audio1" src="somesounds.wav" region="audio"/>
<seq>
<img id="img1" src="foo.gif" region="image" dur=10s>
<img id="img2" src="bar.gif" region="image" dur=17s>
etc.
</seq>
</par>
</body>
</smil>
This markup denotes a presentation that has an audio track that starts when the documents loads. As the audio starts playing, the presentation flips through a set of images that relate to the audio at certain time triggers.
To build this same simple application using DHTML, CSS and the DOM, a developer must be familiar with the all three development modes (i.e. construction of a structure layer, a presentation layer and expose those elements as unique subclasses for control via scripting) and must construct all of the timing logic by hand. In terms of discrete tasks, this would look something like this:
- Begin with media elements
- Build document division element for the image area of the screen with positioning attributes
- Construct a simple timer script (a loop inside a loop that increments a second counter every 1000 milliseconds)
- Construct a switch statement that listens to the timer variable
- Place the source attribute of the image element in the document division at the appropriate switch inflection points
- Test against different client implementations of scripting, CSS and DOM to ensure that everything works as planned.
Now, admittedly, I’m being a little unfair here.
At this point, RealNetwork's G2 beta doesn't
support all of SMIL, so tread carefully. The value
'indefinite' for the duration (<dur>) attribute, for instance, will cause
G2 to choke.
But the point is that the efforts in hand-assembling a time-based presentation using script requires a totally different set of skills than those required to build a multimedia application. In addition, this hand-cobbling is open to some of the same compatibility issues that SMIL detractors have complained about-—especially brittleness in moving between clients.
SMIL provides a very clean metaphor for describing how different elements relate over time. This approach is much more in line with the general character of the Web than the multi-skill, multi-programming metaphor of the hand-coded application.
Microsoft says that it will revisit SMIL when the spec evolves. Let’s hope that the clear superiority of the W3C’s approach has sunk in to the general Web framework by then, making full support a no brainer by all client vendors.
Next week: an assessment of XML support in 5.0 browsers.
[ Click here to return to the first part of the article ]
Contact the WebDeveloper.com® staff
Last modified:
Friday, 22-Aug-2008 13:46:48 EDT
|