Listing 2 shows the syntax for referencing one AMOD from
within another. Notice that this is the same example from the previous section,
with the par element replaced with a reference to an external AMOD. The generic ref tag is used to specify such a reference, and when it points to a valid AMOD,
the type attribute should be set to application/smil+xml.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language">
<head>
<layout>
<region id="banner" />
<region id="content" />
</layout>
</head>
<body>
<seq>
<video region="content" dur="300s" clipEnd="150s" src="http://www.contentPublisher.com/episode1.flv"/>
<ref src="http://www.adNetwork.com/adPackets/adPacket1.smi" type="application/smil+xml" />
<video region="content" dur="300s" clipBegin="150s" clipEnd="300s" src="http://www.contentPublisher.com/episode1.flv"/>
</seq>
</body>
</smil>
Listing 2. An AMOD referencing another AMOD
The nested AMOD, also called the child AMOD, will look like Listing 3.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language">
<head>
<layout>
<region id="banner" />
<region id="content" />
</layout>
</head>
<body>
<par>
<img region="banner" dur="30s" src="http://www.adNetwork.com/banner1.jpg" />
<video region="content" dur="30s" src="http://www.adNetwork.com/inrollad1.flv"/>
</par>
</body>
</smil>
Listing 3. The AMOD called by the AMOD from Listing 2
Notice that if you manually copy the contents of the body tag from the child AMOD shown in Listing 3 and paste them into the parent AMOD
shown in Listing 2—thereby replacing the ref tag—you will get back
the original AMOD from Listing 1. In a lot of ways, this is exactly what
happens when Adobe Media Player executes the merge. There is more, but I will
get back to that later.
The child AMOD is subject to all the same validations as the
parent AMOD. It needs to have the appropriate SMIL namespace, the layout
section containing all the region declarations, and only one root element in the body tag. In other words, the child AMOD needs to be a
fully functional AMOD on its own.
You can include as many references in a parent AMOD as you need. A typical case is one reference per ad break, as shown in Listing 4.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language">
<head>
<layout>
<region id="banner" />
<region id="content" />
</layout>
</head>
<body>
<seq>
<video region="content" dur="300s" clipEnd="75s" src="http://www.contentPublisher.com/episode1.flv"/>
<ref src="http://www.adNetwork.com/adPackets/adPacket1.smi" type="application/smil+xml" />
<video region="content" dur="300s" clipBegin="75s" clipEnd="150s" src="http://www.contentPublisher.com/episode1.flv"/>
<ref src="http://www.adNetwork.com/adPackets/adPacket2.smi" type="application/smil+xml" />
<video region="content" dur="300s" clipBegin="150s" clipEnd="225s" src="http://www.contentPublisher.com/episode1.flv"/>
<ref src="http://www.adNetwork.com/adPackets/adPacket3.smi" type="application/smil+xml" />
<video region="content" dur="300s" clipBegin="225s" clipEnd="300s" src="http://www.contentPublisher.com/episode1.flv"/>
</seq>
</body>
</smil>
Listing 4. AMOD with one external reference per ad break