What you will need…

  • The Player JavaScript Framework.
  • An embedded Viddler player.

How it works…

The Player JavaScript framework gives a developer access to controls within a loaded Viddler player. These controls will include playing and pausing the video or loading in a new video without reloading the page, etc. See the examples below.

How to use it…

First things first you will have to include this line in the <head> of your HTML document.

<script src="http://cdn-static.viddler.com/js/viddler.js" type="text/javascript"></script>

Functions

The following JavaScript functions can be used with both the Full and Simple Players.

viddlerSeek(seconds)
This function will force the player to seek to a time point in the video.

viddlerSwitch(‘object_id’,'username’,videonumber,seconds)
This function will change the video in the player without refreshing the page. You can also force the player to seek to a time point in the video that you’re loading by including the optional ‘seconds’ parameter as the 4th argument.

viddlerOpen(DOMobject,videoid,seconds,secretCode)
This will open a new video in the current player.

  • DOMobject is the ID of the video player in the HTML
  • videoid is the key
  • seconds (optional) is where you want to start the video
  • secretcode (optional) is the number at the end of a secret URL if the video is private

viddlerPause()
Pauses the current player.

getCurrentTime()
Will report the current timestamp for the playhead of the video object.

Example usage: var time = document.getElementById('viddlerplayer').getCurrentTime();

startMovie()
Tells the player to start the video. (Considered legacy)

stopMovie()
Tells the player to stop the video. (Considered legacy)

pauseMovie()
Tells the player to pause the video. (Considered legacy)

playMovie()
Tells the player to play the video. (Considered legacy)

Callbacks

If you’re using the default Quicktime embed you may use consult the Quicktime Javascript documentation here.

The following are JavaScript functions that the player calls. In order to “enable” these within the Viddler players you must include the “enablecallbacks=t” Flashvar.

ViddlerPlayer.tagsModified(videoid)
Called when a tag is modified (added, deleted, edited) on the timeline. (Full player only)

ViddlerPlayer.commentsModified(videoid)
Called when a comment is modified (added,deleted,edited) on the timeline. (Full player only)

playStarted()
Called when the video starts playing.

playEnded()
Called when the video ends. (not when it is stopped or paused)

playPaused()
Called when the video is paused. (not when it ends)

Examples

Seek to…

Jump to a wine: 2005 Chat Le Thil Comte Clary Rouge, or 2005 Chateau Jean Faux

Or, load another episode…

Episode 1272

Episode 1264

We’re looking to add many more functions and callbacks to our player in the near future so please stay tuned.