This is the bocoup web log with posts from Al, Boaz, Rick, Sam, Nate, Nick & Pete. You should also make sure to checkout code.bocoup.com, where we keep the finished versions of ideas we kick around here.


Jul 7, 2010

Popcorn.js Walkthrough

Popcorn.js, which I wrote about recently, is an infant javascript library that allows film makers to better showcase their videos on the web using html5′s video element. Using popcorn, directors can incorporating social media and integrate several features such as subtitles and credits that may be beneficial in the context of the web. Although typically, javascript libraries are written for programmers, popcorn can be configured with less technical knowledge solely by using xml, documented here.

You can view a demo we built for the Mozilla Summit here (best in Firefox)

Setup

Note: Version 0.1 of popcorn.js has just been released, and the library is not even close to stable. If you have specific issues you’re having, talk to us at irc.mozilla.org/popcorn.

Setting up popcorn is really easy, and requires only basic knowledge of html. First, download popcorn.js and include it using

Next, you have to tell popcorn which video it should care about by setting its data-timeline-sources attribute. Your video should look something like this:

How to use popcorn

Popcorn is very simple to use, and is completely managed through the xml file addressed earlier.

Popcorn focuses heavily on the video’s timeline. Nearly every element of popcorn has an ‘in’ and ‘out’ method that tells popcorn when the feature should be visible on the page. The syntax for these methods is hours:minutes:seconds:frames. For example, two minutes three seconds would be 00:02:03:00.

A basic example of popcorn that requires no additional html elements would be implementing subtitles. The syntax to do so would be:

This is just one part of popcorn, for further information, view the xml specification.

Notable Features

Social Integration

Popcorn has strong integration with social media sites such as Twitter, Tumblr, and Wikipedia. Each service has slightly different syntax and variables, view the xml documentation for more details.


Credits

Hierarchical credits, which automatically play at the commencement of your video, are automatically generated by popcorn.js. Currently, credits are coded into the library, but they will soon be implemented into the xml.


Subtitles

Subtitling, I feel, is perhaps the most interesting facet of popcorn.js. The credits used in popcorn.js evolves from my earlier, overly-animated work.


Accessibility

Although often ignored, accessibility is extremely important, and can broaden your target audience immensely. Those with hearing disabilities can understand the video’s contents by reading it, and the subtitles can be translated in realtime using the wonderful Google translate API. Furthermore, your video’s content is stored as text, making your html more accessible to search engines than flash alternatives.

I’m really excited to see how popcorn matures. While content producers have done amazing things with video on the web, browsers have lagged behind. A long overdue push for accessible video is underway, and popcorn will advance the effort.



Comments:

2 Comments

  1. Posted July 9, 2010 at 2:40 am | Permalink

    I’m excited about popcorn.js – will is support standard formats like Subrip and websrt for subtitles?

  2. Posted July 12, 2010 at 10:12 am | Permalink

    Hey Bill,

    That was a major discussion during the development of popcorn.js actually. While technically speaking, it would not be tremendously difficult to support those formats, currently popcorn.js does everything through xml. So for now, no.

    However, a simple program that would take standard subtitle formats and convert it into popcorn script would be pretty cool.

    - Nick

One Trackback

  1. [...] This post was mentioned on Twitter by Boaz Sender. Boaz Sender said: New post on PopcornJS, the JavaScript Library for Linking HTML5 video timestamps to the web from @nicklovescode: http://gul.ly/8l [...]




Please send your questions to this address or call Bocoup at 617-379-2752
This web page is proudly maintained by Bocoup and hosted by (mt) Media Temple
All code on this website is Open Source