Archive for February, 2011

Popcorn.js 0.1 vs 0.2 XML grammar and plugin API

Posted in open source, video, webmademovies on February 7, 2011 by scottdowne

I recently was asked for help with the XML grammar I created for Popcorn.js. I am aware this is not documented very well, but mostly because things have changed from our 0.1 to 0.2.

I ended up creating a pretty thorough email… and figured it was a waste as *just* an email, so I am going to make a blog post about it as well.

These links are the documentation for the old 0.1 XML:

old 0.1 documentation
old 0.1 XML example

The last comment here are the changes for 0.2 that the above links do not represent.

This is an up to date example of a working 0.2 XML file.

I am also going to show you a quick abstract example here, then explain it afterwards.

<popcorn>

  <manifest>

    <resource id="resourceid1" target="containerid1"/>
    <resource id="resourceid2" target="containerid2"/>

  </manifest>

  <timeline>

    <parent1 sharedattribute="value">

      <pluginname resourceid="resourceid1" in="00:00:32:00" out="00:00:40:00">text</pluginname>
      <pluginname resourceid="resourceid2" in="00:00:32:00" out="00:00:40:00">text</pluginname>

    </parent1>
    <parent2 sharedattribute="value">

      <pluginname resourceid="resourceid1" in="00:00:32:00" out="00:00:40:00">text</pluginname>
      <pluginname resourceid="resourceid2" in="00:00:32:00" out="00:00:40:00">text</pluginname>

    </parent2>

  </timeline>

</popcorn>

As you can see you need one parent tag called popcorn.

Popcorn has two children, manifest which is optional, and timeline which is mandatory.

A plugin is referenced by name, as an XML tag, and all its options follow as XML attributes. in and out attributes in the XML are the same as start and stop options in the plugin. A resourceid attribute will inherit all attributes in the connecting id of something in the manifest.

A plugin or resource can have an unlimited number of parents that simply pass down their attributes to their children until hitting a plugin.

Any tag in the timeline that does not have children will be considered a plugin.

All plugin names, and attribute names are transparent in that they are not rigidly defined, but defined by the plugins currently loaded.

Think of the XML grammar as the syntax, and the plugins as the API.

Each plugin has documentation and an examle for it here.

The parent and resource names do not matter, you can call them whatever you think makes sense for your use case.

Follow

Get every new post delivered to your Inbox.