Popcorn.js 0.1 vs 0.2 XML grammar and plugin API

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.

Advertisements

3 Responses to “Popcorn.js 0.1 vs 0.2 XML grammar and plugin API”

  1. Apologies for replying to a very old post, but unable to find any discussion / support forum for popcorn.js. Attempting to use the XML grammar as described above to load data for the popcorn “code “plugin – however unable to construct any attributes that pass the needed javascript function references. Is the code plugin supported when employing the XML structure as described above?

  2. Thanks for your quick reply. Am writing a workflow to export a popcorn timecode file from Final Cut Pro, to replace an older system that used SMIL markup (an XML-based format). But the conversion to JSON should be trivial. Thanks again.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: