Popcorn.js and Processing.js: a match made in CDOT

On Friday last week, I took ownership of a ticket that had been in limbo since late march.  The ticket asked for a Processing.js plug-in for the Popcorn.js library.  This sounded like a cool idea, so I was pretty excited to get the plug-in ready for review.

From what I saw in the ticket, there was a lot of back and forth on this, and there was already code to work with. Sounds great right? Then I looked at the code... now, I'm not saying its terrible.. but it is riddled with flaws.  None of the code conforms to the Popcorn style guide. It used custom script fetching methods instead of using the tools provided by Popcorn. And it interacted in an inefficient manner with the Processing API.

Another major issue, was that it worked backwards.. "Backwards?", you might ask... well, yes. Where the common consensus is that "_start" defines the beginning of something and "_end" defines when it disappears in Popcorn... this plug-in decided the times between start and end should define when it does not play.  All these things combined pretty much had me realize that this wasn't going to be easy.  A major re-write was in order.  Now not ALL of this code was unusable and I managed to salvage some of it so that I didn't have to start from scratch.

Here's a small demo to show that it's functional, and working like a charm :3

Next steps: Unit tests, and the peer reviews.