Topic Keywords: Sending MMS, SMIL
A recent thread on the NowSMS discussion board made my head hurt: MMS: first shows a picture and then the text
It started off simple enough.
If you send an MMS message using the simple web form in NowSMS, and you include some text and an image, the resulting message displays the text first and then the image.
What if you want the image displayed first and then the text?
Or what if you want the text to be displayed as a caption under the image, on the same page, instead of on a separate page?
The first scenario is simple to address. The second scenario is where you may require an aspirin.
Des did an excellent job of addressing the scenario of displaying the image first, and then the text:
NowSMS inserts objects in the order that they are presented.
Instead of using the text object, put the text in a file and attach that file after the image.
If you want more full control, you need to create your own SMIL and include it as one of the objects (use a .smil file extension).
If no SMIL is included, NowSMS auto generates some simple SMIL that presents one object per page in the order in which the objects were attached.
If only Des didn’t mention SMIL. He could have left the answer simple and moved on to another question.
But that is not our way.
So what exactly is SMIL?
SMIL is a presentation language that is used to configure how an MMS message is displayed, similar to how HTML is a presentation language that is used to configure how information on a web page is to be displayed.
However, while HTML is a very powerful and flexible presentation markup language, SMIL is a very simplistic and limited presentation markup language. And MMS SMIL, which is a subset of Basic SMIL, which is a subset of SMIL, is even more limited still.
I like to think of SMIL as a simple presentation language for slide show presentations. SMIL organizes the slides, or pages, of an MMS message presentation. Sort of like PowerPoint, but again, much more limited.
Have I emphasized enough that SMIL, especially MMS SMIL, is very limited? So don’t expect to wow your audience with complex charts and graphics.
Before we dive further into SMIL, let’s backup and look at what an MMS message is.
An MMS message is very similar to an e-mail message, in many ways you can think of MMS as an e-mail system designed for mobile phone networks. (Looking for more information on the transport level implementation? If so, see our article How MMS Works).
Like an e-mail message, an MMS message has a header that contains information such as who the message is “From” and who it is “To”, along with a “Subject”.
The content of an MMS message is a collection of one or more multimedia objects, such as text, image, video and audio. MMS messages can also contain other objects such as address cards (vCards), calendar appointments (vCal), Java applications, and more, if supported by the MMS client on the mobile phone. But for the most part you are dealing with one or more text, image, video and/or audio objects.
If you think of an e-mail message, you think of a text object, along with zero or more attachments.
Or, a more modern e-mail message might be HTML formatted, so that the multimedia objects are automatically displayed when the e-mail message is opened.
Similar to HTML being used in an e-mail message, an MMS message should always have a SMIL presentation part which determines how the MMS message is displayed. (If a SMIL presentation is not included in an MMS message, many operator MMS systems will automatically generate SMIL and add it to the message before it is received by the recipient.)
When included in an MMS message, a SMIL presentation becomes one of the objects within an MMS message. A typical MMS message that contains text and an image would have three objects contained in the MMS message, a SMIL object, a text object and an image object.
Let’s stop using the word object. When building an MMS message, an object is a file. So our typical MMS message with text and an image has three separate files that are the content of the MMS message, a SMIL file, a text file and an image file (e.g., PNG, JPEG, GIF).
One important conceptual difference between SMIL and HTML is that there is no in-line text within a SMIL presentation. If you want to include text in a SMIL presentation, you include a reference to a separate text object/file.
Another important conceptual difference is that you have to consider the relatively small screen of most devices that will be receiving MMS messages.
For all practical purposes, you should not include more than one of the same type of object in a single page (slide) of the SMIL presentation. This means more than one image on a page is generally not recommended because of the limitations of most devices. More than one text object on a page is also not recommended.
The MMS Conformance Document from the Open Mobile Alliance goes into more detail. Basically each page of a SMIL presentation can have no more than two regions, an image region and a text region. The image region can have a single image or a video. The text region can have a single text object. An audio object can play while the page is being displayed.
That’s really all there is to it. Full SMIL has capabilities like setting text and background colors, however the subset that is MMS SMIL, as defined in the MMS Conformance Document, does not include those attributes.
Let’s go back to our original scenario, sending an MMS message that includes text and an image.
The Send MMS Message web form (and the NowSMS Proprietary URL API) include a single text field and zero or more files to include in the message.
When NowSMS processes the web form, if a text field is present, NowSMS automatically converts the text field into a text file to be included as the first object in the MMS message.
If a SMIL file is not included among the files to be included in the message, NowSMS automatically generates one.
For the widest compatibility with different devices, the default SMIL that NowSMS generates has one object per page. If the text field was used in the submission, it becomes the first page. Other pages are generated based upon the order in which objects were included in the submission.
The default NowSMS SMIL will typically look like this:
<smil> <head> <layout> <region id="Image" height="100%" width="100%" fit="meet"/> <region id="Text" height="100%" width="100%" fit="scroll"/> </layout> </head> <body> <par dur="3s"> <text src="filename.txt" region="Text"/> </par> <par dur="5s"> <img src="image.jpg" region="Image"/> </par> </body> </smil>
The start of the SMIL is a header and opening for the body section:
<smil> <head> <layout> <region id="Image" height="100%" width="100%" fit="meet"/> <region id="Text" height="100%" width="100%" fit="scroll"/> </layout> </head> <body>
The layout section defines two regions, as instructed by the MMS Conformance Document. For simplicity, NowSMS automatically generated SMIL says that either section can take up the entire height and width of the page. Images are scaled to “meet” the size of the screen, while text is allowed to “scroll” if it is too large.
More complex region layouts can be designed, but the MMS Conformance Document states that an MMS Client may choose to replace the layout section with its own terminal specific layout, so we have yet to see the point of such an effort.
Each page of the SMIL presentation is represented by a <par> section:
<par dur="3s"> <text src="filename.txt" region="Text"/> </par> <par dur="5s"> <img src="image.jpg" region="Image"/> </par>
text, img, video and audio tags with a src parameter define objects that appear in the MMS message. You’ll see text and img tags in the above example. The src parameter of one of these object tags refers to another content object/filename that is included in the message. Unlike HTML format e-mails, you cannot reference content by an external HTTP link. Any content referenced by your SMIL must be a file that is included in the MMS message content.
The “dur” parameter for the <par> element specfies how long a particular slide is displayed.
In this example, the text that was submitted as part of this MMS message was included in a text file named filename.txt. The image was an image file named image.jpg.
When submitting files to be included in an MMS message with NowSMS it is important to use common filename extensions such as .txt and .jpg. This is because when NowSMS packages the files into an MMS message, NowSMS needs to specify the MIME content type of the files. NowSMS uses the filename extension to MIME content type mappings defined in the MMSCTYPE.INI file that is in the NowSMS program directory.
Finally, the SMIL is concluded with tags to close the presentation:
</body> </smil>
It is easy to override the automatically generated SMIL by creating your own SMIL. You then include this SMIL as one of the content objects in your MMS message. (Again filename extensions are important …. be sure to give the file a “.smil” file extension, so that NowSMS will recognise it as such.) All “src=” references within your SMIL should be for filenames of other files that are being included in the MMS message.
For example, to have the image and text display on a single page, you could do make this change:
<smil> <head> <layout> <region id="Image" height="100%" width="100%" fit="meet"/> <region id="Text" height="100%" width="100%" fit="scroll"/> </layout> </head> <body> <par dur="5s"> <text src="filename.txt" region="Text"/> <img src="image.jpg" region="Image"/> </par> </body> </smil>
When submitting the MMS message, you would need to include the SMIL file, along with filename.txt and image.jpg.
You could also change the “%” of height for the text and image regions for best results, but be aware that a lot of MMS clients will ignore it.
Also note that when you generate your own SMIL, you should include any text objects as separate files, not using the “MMS Text” parameter of the NowSMS web interface. This is because NowSMS automatically converts the “MMS Text” into a file, but it generates a temporary name for the text file, so it is not possible to reference this text in your SMIL
There is more discussion back on the discussion board thread MMS: first shows a picture and then the text, but hopefully this discussion is more digestable as a simple tutorial for creating your own SMIL in an MMS message.
For more information, I highly recommend referring to the MMS Conformance Document from the Open Mobile Alliance, which can be found at the following location: http://openmobilealliance.org/Technical/release_program/mms_v1_2.aspx.
The full SMIL 2.0 specification can be found at http://www.w3.org/TR/2005/REC-SMIL2-20050107/.
For comments and further discussion, please click here to visit the NowSMS Technical Forums (Discussion Board)...