SMIL

SMIL [cite SMIL30] is a format centered on time-based control abstractions, useful as a stand-alone web format (i.e. as the root document type) as well as a controller embedded in other formats such as the XHTML/ODF compound document used in our expense tracker application. Time based control is particularly prevalent in multimedia presentations and demonstrations, for example in kiosks and online training.

A SMIL slideshow embedded in a webpage
Figure 11: A SMIL slideshow embedded in a webpage

The NYC tour in Figure 11 consists of a coordinated set of images, audio, and captions. Each set is played in parallel, with the next set shown when the previous one has finished. The overall control structure of this simple example is then a sequence of parallel sections, each containing audio, image, and caption.

This markup for this example is executable directly in the Safari, Chrome, IE, and FireFox browsers using the proof-of-concept SMIL Ubiquity implementation jsambulant.

SMIL control can not only be time-based but also event-based, to allow for user interaction within a SMIL presentation. SMIL also has a data model, shared with XForms, to allow stateful presentations. In a rich web document, these features allow creation of an adaptive multimedia presentation that reacts to things happening elsewhere in the document. Figure 12 is an example of this (referring back to the data model of figure 7): it will play a warning message (once only) whenever your entertainment costs go over $100.


<smil:par>
  <smil:video begin="stateChange(instance('categories')/category/total)" 
         expr="instance('categories')/category[name='Entertainment']/total &gt; 100"
         src="expense_warning.ogv"
         restart="never" />
  <!-- rest of SMIL presentation -->
</smil:par>

Figure 12: SMIL reacting to data model changes

The event model and the data model, augmented with XForms facilities like xf:dispatch and xf:send, enable the use of SMIL as a controller language. The temporal logic of the application could be specified in SMIL, using the data or event model to drive other components of the application. This pattern can be used on various scales. As an example of a small-scale use, think of things like a wizard controller, where it drives the order of a number of sequenced forms. Large scale examples would be things like courseware, quizzes or games.