We now have a Media Analytics plugin that tracks Videos & Audio!
More information is available here: http://www.media-analytics.net/ The plugin gives useful insights into media / video / audio analytics and adds many new reports, widgets and segments to Piwik.
Works with HTML5 video & audio, Vimeo and YouTube out of the box. Support for other players can be added easily and is documented in the developer docs. We are also happy to add support for more players upon request, please ping us. After installation the plugin will in most cases directly start tracking data see the setup guide
This should add events to your piwik analytics for video play, error, pause, seeking, and completion – with the length played as the event value for the latter three.
I’m not familiar with the wordpress plugin you’re referring to but you should be able to place that javascript anywhere after your HTML5 video tags, or place it in an onload.
It could also potentially be placed in a deferred javascript file, though I have found deferred javascript loading to be unreliable at best.
If your videos are being added to the DOM asynchronously you will have to run the code using a callback.