Package com.objectxp.mms.message.smil

The smil package contains classes for constructing SMIL (Synchronized Multimedia Integration Language) documents.

See:
          Description

Class Summary
Anchor This class represents the SMIL "a" element (anchor).
Animation This class represents a SMIL "animation" element (Animated vector graphics or other animated format).
Area This class represents a SMIL "area" element.
Audio A SMIL "audio" element.
Body This class represents the SMIL "body" element.
Element Base class form SMIL elements.
Head A SMIL "head" element.
Image This class represents a SMIL "img" element.
Layout This class represents a SMIL "layout" element.
Link A SMIL Generic media reference ("ref").
Media Base class for MMS Media elements.
Region A class representing the SMIL "region" element.
RootLayout This class represent the SMIL "root-layout" element.
Sequence Sequence represents the SMIL "seq" element.
SmilDocument This class represents a SMIL (Synchronized Multimedia Integration Language) document.
Switch The switch element allows an author to specify a set of alternative elements from which only one acceptable element should be chosen.
Text This class represents a SMIL "text" element.
Textstream A SMIL streaming text ("textstream").
Timer The Timer class represents a SMIL "par" element.
Timing Base class for SMIL timing elements.
Video A SMIL "video" element.
 

Package com.objectxp.mms.message.smil Description

The smil package contains classes for constructing SMIL (Synchronized Multimedia Integration Language) documents.

SMIL is a simple XML-based language that consists of a set of modules that define the semantics and syntax for certain areas of functionality. Examples of these modules are layout module, timing module and animation module. For more Information about SMIL visit http://www.w3.org/TR/smil20/.

SMIL provides extended capabilities to display messages on the target device, such as timing of multimedia objects.

Below is an example of a SMIL document which times two multimedia objects:

  1. Display the content of the object 'hello.txt' for 5 seconds
  2. Display the the image 'picture.jpg' for another 5 seconds
    <smil>
      <head>
        <layout><root-layout width="160" height="140"/></layout>
      </head>
      <body>
        <par dur="5s">
          <text src="hello.txt"/>
        </par>
        <par dur="5s">
          <img src="picture.jpg"/>
        </par>
      </body>
    </smil>
Assuming that the SMIL document above (and the two referenced objects - 'hello.txt' and 'picture.jpg') are stored in "/tmp/smil.xml", you could construct a SMILMessage like this:
    SMILMessage msg = new SMILMessage(new File("/tmp/smil.xml").toURL());

The way to create the same document using the classes in this package is shown below:

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import com.objectxp.mms.message.smil.Body;
import com.objectxp.mms.message.smil.Head;
import com.objectxp.mms.message.smil.Image;
import com.objectxp.mms.message.smil.Layout;
import com.objectxp.mms.message.smil.RootLayout;
import com.objectxp.mms.message.smil.SmilDocument;
import com.objectxp.mms.message.smil.Text;
import com.objectxp.mms.message.smil.Timer;

/**
 * This example Demonstrates how to construct a SMIL document using jSMS.
 */
public class SmilExample 
{
  public static void main(String[] argsthrows FileNotFoundException, IOException 
  {
    // create a new SMIL document
    SmilDocument doc = new SmilDocument();

    // Head and Body elements
    Head head = new Head();
    Body body = new Body();

    doc.addElement(head);
    doc.addElement(body);

    Layout layout = new Layout();
    RootLayout rl = new RootLayout();
    rl.addAttribute(RootLayout.WIDTH, "160");
    rl.addAttribute(RootLayout.HEIGHT, "140");
    layout.addElement(rl);
    head.addElement(layout);

    // add first element
    Timer part1 = new Timer();
    part1.addAttribute(Timer.TIMING_DUR, "5s");
    body.addElement(part1);
    part1.addElement(
      new Text("Hello World".getBytes()"hello.txt""text/plain"));

    // add second part
    Timer part2 = new Timer();
    part2.addAttribute(Timer.TIMING_DUR, "5s");
    body.addElement(part2);
    part2.addElement(
      new Image(
        new FileInputStream("/tmp/picture.jpg"),
        "picture.jpg",
        "image/jpeg"));
}



object XP, Inc. © 2000-2007. All rights reserved object XP