Home Doc API Examples GitHub

Documentation

The timingsrc library implements the timing object programming model. This document briefly introduces the following concepts and provides links for further documentation.

Note that the timingsrc library implements Immediate Events semantics for many of its event types.

Module

The timingsrc module provides timing objects, timing providers, and tools for sequencing and media synchronization. The module is implemented as plain JavaScript and packaged for regular script inclusion as well as AMD module for use with requirejs, see helloworld and helloworld-require for full examples.

// regular script import - 'TIMINGSRC' property on global object 
var timingsrc = TIMINGSRC;              
// require js module import
var timingsrc = require("./timingsrc");
// use the module
var timingObject = new timingsrc.TimingObject();

The timingsrc module is implemented in plain JavaScript and should run in every modern Web browser.

The timingsrc library is available from GitHub.

Timing Objects

The timing objects is the basic concept of this programming model. You may think of it as an advanced stop-watch. If you start it, its value progresses as a clock, until you pause or resume it later. The timing object additionally supports behavior like time-shifting, different velocities (including backwards), and acceleration.

Timing Converters

Timing converters are a special kind of timing objects that depend on an other timing object. Timing converters are useful when you need an alternative representations for a single timing object. For instance, timing converters may be used to shift or scale the timeline.

Timing Providers

Timing objects may become multi-device by connecting with an online timing provider. Shared Motion by Motion Corporation implements the Timing Provider API and can therefore be used directly with the timing object.

Sequencing Tools

Given a timing object, a common challenge is to correctly align timed data. This challenge is known under many names; timed events, triggers, upcalls etc. Such timed data are also commonly collected into scripts, tracks, logs or time-series. Here the term sequencing broadly refers to the translation of timed data into timed execution. We are not making any distinction concerning the specific type of data, and instead aim to provide generic mechanisms useful for a wide variety of applications.

setPointCallback and setIntervalCallback are simple tools inspired by setTimeout and setInterval. setPointCallback triggers a callback when the timing object passes by a specific point on the timeline. setIntervalCallback is associated with periodic points along the timeline.

The Sequencer is a more sophisticated tool designed to work on larger sets of points and intervals. Both emit enter and exit events as intervals becomes active or inactive, but differ in how they define this condition.

check out impressive old style sequencing video here!

Media Synchronization Tools

Ideally, we would like HTML5 Media Elements to implement timed playback mode and accept the timing object as timingsrc. However, until this is a reality we need to address media synchronization in JavaScript. The MediaSync library is made for this. It is based on a comprehensive study of the behavior of media elements in a variety of browsers. The MediaSync library is not optimised for specific combinations of browser, media type and architecture, but aims to provide best effort synchronization in very different settings.