We use the wildly popular JW Player for playback of your videos. Like Bits on the Run itself, the JW Player features an extensive API. Using this API, you can fully control the player with javascript. This page offers shortcuts to the relevant documentation at the JW Player website.
Initialization
When the page loads, all videoplayers register themselves with javascript.
- playerReady() Fires when the player is succesfully initialized and drawn on the page.
Reading variables
There's two variables you can access through the player API:
- player.getConfig(): Returns all variables (flashvars) loaded into the player.
- player.getPlaylist(): Returns an array with all entries in the players' playlist.
Note that Bits on the Run does not include plugin management for the JW Player yet. Plugins can be loaded with a workaround though.
Sending events
By sending events to the videoplayer, you can control it from javascript:
- player.sendEvent(): Send a control directive to the videoplayer.
Here is a tutorial on sending events to the player. You can also use events to create playlists with javascript.
Setting listeners
By setting listeners to the videoplayer, you can detect and react upon the playback state:
- player.addControllerListener(): events that respond to user input.
- player.addModelListener(): events that respond to playback state changes.
Here is a tutorial on adding listeners to the player.
If you're living in (or willing to relocate to) New York, NY or Eindhoven, NL and you're looking to join a cutting-edge online video company, please